Referrer Status Set?
|
Help
|
$ID = $_POST['ID'];
$CID = $_POST['CID'];
$wh = $_POST['wh'];
$name_1 = $_POST['name_1'];
$name_2 = $_POST['name_2'];
$name = $name_1." ".$name_2;
$Company = $_POST['Company'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$Country = $_POST['Country'];
$ZipCode = $_POST['ZipCode'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$Link = $_POST['Link'];
$trak= $_POST['track'];
$req_by = $_POST['req_by'];
$repusrn = $_POST['repusrn'];
if($repusrn == ""){
$repusrn = $usrn;
}
$refstat = $_POST['refstat'];
$pay = $_POST['pay'];
$rate = $_POST['rate'];
if($pay == ""){
$pay = "no";
$rate = 0;
}
$product = $_POST['product'];
$prodcut = explode(':', $product);
if($prodcut[0] == "all"){
$mailproduct = "of Eco-\$mart Products";
$prodcut1="ALL";
}else{
$pay = "Flat Fee";
$rate = $prodcut[2];
$mailproduct = "of the ".$prodcut[0];
$prodcut1=$prodcut[1];
//TRI is the three character string used to name the folder on the server that contains the specific product referrer webpages.
}
$dtnum = $_POST['dtnum'];
$chunk_dtnum = chunk_split($dtnum, 2, ':');
$chunk_arr = explode(":", $chunk_dtnum);
$datus = $chunk_arr[2].'-'.$chunk_arr[3].'-'.$chunk_arr[0].$chunk_arr[1];
mysql_select_db('ecosmar_contacts', $dbcnx);
$into = mysql_query("INSERT INTO refcon SET name_1='$name_1',name_2='$name_2',Company='$Company',address='$address',city='$city',state='$state',Country='$Country',ZipCode='$ZipCode',phone='$phone',email='$email',Link='$Link',track='$trak',status='$refstat',pay='$pay',rate='$rate',product='$prodcut[1]',req_by='$req_by',dtnum='$dum'");
if (!$into) {
echo("
Error adding to Referrers List.
" . 'Error: '. mysql_error(). '
');
}else{
$RID = mysql_insert_id();
echo("
Successful Addition to Eco-\$mart Referrers List. ID Assigned: $RID
");
}
$out = mysql_query("DELETE FROM refcon_new WHERE ID='$ID' LIMIT 1");
if (!$out) {
echo("
Error removing Contact from New Referrers List.
" . "Error: ". mysql_error(). "
");
}else{
echo("
Removed from New Referrers List.
");
}
$sql = "OPTIMIZE TABLE refcon_new";
if(!$sql){
echo("
Problem Optimizing Data Base
" .
"Error:" . mysql_error() . "
");
}else{
echo("
Data Base Optimization complete.
");
}
$Notes = "Became Authorized Referrer. Referrer ID: ".$RID;
$recordit = mysql_query("INSERT INTO con_notes SET CID='$CID',Notes='$Notes',usrn='$repusrn',dtnum='$dum'");
if(!$recordit){
$bad[] = "Could not insert contact notes.";
}
if($trak == "Yes"){
mysql_select_db('ecosmar_website', $dbcnx);
$intrack = mysql_query("INSERT INTO webtrack SET RID='$RID',name_1='$name_1',name_2='$name_2',Company='$Company',email='$email',dom='$Link',count='0',dtup='$dtnum',dtnum='$dtnum'");
if(!$intrack){
echo("
Problem Starting Web Tracker
" .
"Error:" . mysql_error() . "
");
}else{
$recipient = "mross@eco-smart.com".", "."kent@kwgrubbs.com".", ".$email;
$subject = "Eco-Smart.com Web Tracker Account Started";
$message ="This is to inform you a Web Tracker Account has been started at eco-smart.com" .
"\n" .
"FOR:" .
"\n" .
"\n" .
"NAME: $name" .
"\n" .
"COMPANY: $Company" .
"\n" .
"DOMAIN: $Link" .
"\n" .
"REFERRER ID: $RID" .
"\n" .
"\n" .
"Visits to eco-smart.com from your website will be counted, and visitor contact with Eco-\$mart will be logged with your Referrer ID." .
"\n" .
"In order for visits to be counted, the link to our website must be:" .
"\n" .
"http://www.eco-smart.com/" .
"\n" .
"There are several addresses one can use to access the Eco-\$mart Website. This is the only one that counts!" .
"\n" .
"\n" .
"View an activity report for your Referrer ID at Eco-\$mart Web Tracker. Go to:" .
"\n" .
"http://www.ecosmartinc.com/trak/" .
"\n" .
"You will need your Referrer ID to access your Web Tracker Page" .
"\n" .
"\n" .
"Please let us know if you need assistance." .
"\n" .
"Matt Ross" .
"\n" .
"President, Eco-\$mart, Inc." .
"\n" .
"(888)329-2705" .
"\n" .
"info@eco-smart.com" .
"\n" .
"www.eco-smart.com" .
"\n";
$headers = 'From: info@ecosmartinc.com' . "\r\n" .
'Reply-To: info@ecosmartinc.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(@mail($recipient, $subject, $message, $headers)) {
echo("
Webtracker Started. Referrer Code: $RID
" .
"Email Notification Sent
");
}//if mail
}//if successful wt insert
}//if trak is yes
else{// no tracking
if($refstat == "Active"){
$recipients[] = "mross@eco-smart.com";
$recipients[] = "ecosmart@kwgrubbs.com";
$recipients[] = $email;
foreach($recipients as $value){
$subject = "Eco-Smart.com Referrer Account Started";
$message ="This is to inform you that a Referrer Account has been started for you at Eco-Smart.com." .
"\n" .
"FOR:" .
"\n" .
"\n" .
"NAME: $name" .
"\n" .
"COMPANY: $Company" .
"\n" .
"REFERRER ID: $RID" .
"\n" .
"\n" .
"Customers who provide your Referrer ID when making a purchase $mailproduct are logged as your referral and payment will be made to you when the purchase is complete." .
"\n" .
"In order for your referral to be counted, the customer must include your Referrer ID when ordering." .
"\n" .
"Your Referrer ID should be included on any sales materials or Eco-\$mart Referrer Cards used to promote our products." .
"\n" .
"\n" .
"View an activity report for your Referrer ID at our website. Go to:" .
"\n" .
"http://www.ecosmartinc.com/$prodcut1/ref/" .
"\n" .
"You will need your Referrer ID and the email address you gave when registering to access your Referrer Log." .
"\n" .
"\n" .
"Please let us know if you need assistance." .
"\n" .
"Matt Ross" .
"\n" .
"President, Eco-\$mart, Inc." .
"\n" .
"(888)329-2705" .
"\n" .
"info@eco-smart.com" .
"\n" .
"www.eco-smart.com" .
"\n";
$headers = 'From: info@ecosmartinc.com' . "\r\n" .
'Reply-To: info@ecosmartinc.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(@mail($value, $subject, $message, $headers)) {
echo("
Notification Sent. Referrer Code: $RID
");
}//if mail
else{
echo("
Could not send notification to $value
");
}//could not send mail
}//foreach recipient
}//status is Active
}//no tracking
?>
if($wh == 1){
echo("