2) $newfname = ucwords(strtolower($newfname)); else $newfname = strtoupper($newfname); $newic = trim(strtoupper($newic)); $newrebrand = trim(strtolower($newrebrand)); $newphone = trim($newphone); $newemailaddress = trim(strtolower($newemailaddress)); $dt = date("g:i:s A", mktime(date("G")+13,date("i"),date("s"),date("m"),date("d"),date("Y"))); $ddd = date("jS F Y (D)", mktime(date("G")+13,date("i"),date("s"),date("m"),date("d"),date("Y"))); if ($resubmit) { setcookie("returning", "yes"); $dirname = getcwd()."/$coy/$oldreferral"; $filename = $dirname."/revisit-log.txt"; @touch ($filename); $handle = @fopen($filename, 'a'); if ($handle) { fwrite($handle, $newlname."\t".$dt."\t".$ddd."\t".$newfname."\t".$newphone."\t".$newemailaddress."\t".$newic."\t".$newcountry."\t".$oldreferral."\t".$ip."\n"); fclose ($handle); } else mail("business@onlinesrs.com", "Shouldn't reach here...", $script_name."\nResubmit fopen failed : $filename", "From: $brand<$adminemail>\nX-Mailer: PHP/" . phpversion()); } if ($submit) { $msg = ""; if (!$newlname) $msg = $label2; if (!$newfname) $msg = $label3; if (!$newphone) $msg = $label5; if (!$newemailaddress) $msg = $label4; if (!$newcountry) $msg = $label6; if ($msg) Header ("Location: no-script.htm?c=$coy&r=$referral&m=$market&msg=".urlencode($msg)); $skip = 1; if ($newlname != $HTTP_COOKIE_VARS['lname']) $skip = 0; if ($newfname != $HTTP_COOKIE_VARS['fname']) $skip = 0; if ($newic != $HTTP_COOKIE_VARS['ic']) $skip = 0; if ($newrebrand != $HTTP_COOKIE_VARS['rebrand']) $skip = 0; if ($newemailaddress != $HTTP_COOKIE_VARS['emailaddress']) $skip = 0; if ($newcountry != $HTTP_COOKIE_VARS['country']) $skip = 0; if (!$skip) { setcookie("lname", $newlname, time()+60*60*24*30*12); $lname = $newlname; setcookie("fname", $newfname, time()+60*60*24*30*12); $fname = $newfname; setcookie("ic", $newic, time()+60*60*24*30*12); $ic = $newic; setcookie("rebrand", $newrebrand, time()+60*60*24*30*12); $rebrand = $newrebrand; setcookie("country", $newcountry, time()+60*60*24*30*12); $country = $newcountry; setcookie("phone", $newphone, time()+60*60*24*30*12); $phone= $newphone; setcookie("emailaddress", $newemailaddress, time()+60*60*24*30*12); $emailaddress= $newemailaddress; setcookie("ip", $ip, time()+60*60*24*30*12); setcookie("dd", $dd, time()+60*60*24*30*12); $dirname = $root; $filename = $dirname."/visitors.txt"; touch ($filename); $handle = @fopen($filename, 'a'); $visitor = ucwords(trim($lname)); fwrite($handle, $visitor."\t".$dt."\t".$ddd."\t".$fname."\t".$phone."\t".$emailaddress."\t".$ic."\t".$country."\t".$referral."\t".$ip."\t".$referer."\n"); fclose ($handle); } } else { if (!$rebrand) $rebrand = $HTTP_COOKIE_VARS['rebrand']; if (!$lname) $lname = $HTTP_COOKIE_VARS['lname']; if (!$fname) $fname = $HTTP_COOKIE_VARS['fname']; if (!$ic) $ic = $HTTP_COOKIE_VARS['ic']; if (!$country) $country = $HTTP_COOKIE_VARS['country']; if (!$phone) $phone = $HTTP_COOKIE_VARS['phone']; if (!$emailaddress) $emailaddress = $HTTP_COOKIE_VARS['emailaddress']; if (!$ip) $emailaddress = $HTTP_COOKIE_VARS['ip']; if (!$dd) $emailaddress = $HTTP_COOKIE_VARS['dd']; // if (!$referral) $referral = $HTTP_COOKIE_VARS['referral']; } if (($submit) && (!$skip)) { if (!$referral) { // $referral = "specials"; mail("affiliates@onlinesrs.com", "Error: Referral missing in how-it-works.htm", $script_name."\n$lname\n$fname\n$emailaddress\n$referral", "From: $brand<$adminemail>\nX-Mailer: PHP/" . phpversion()); die("ERROR: Please report this to $adminemail with details on how you get this error page. Thank you!"); } $line = array(); $line = getprofile($referral); $referralname = rawurlencode($line[2]); $referralid = rawurlencode($line[3]); $referralcontact= rawurlencode($line[4]); $referrafname = rawurlencode($line[5]); $referralemail = $line[7]; $referralsponsor = $line[10]; // Get the referral's sponsor details! $line = getprofile($referralsponsor); $sponsorname = $line[2]; $sponsorid = $line[3]; $sponsorcontact= $line[4]; $sponsorfname = $line[5]; $sponsoremail= $line[7]; $sponsor = $line[10]; $referrafname = rawurldecode($referrafname); $referralname = rawurldecode($referralname); $referralcontact = rawurldecode($referralcontact); $cty = rawurldecode($country); $lname2 = rawurlencode($lname); ob_start(); IncludeFile("text/$coy/welcome-msg-".$market.".txt"); $body = ob_get_contents(); ob_clean(); ob_start(); IncludeFile("text/$coy/autorespond-msg-".$market.".txt"); $autorespond = ob_get_contents(); ob_clean(); ob_start(); IncludeFile("text/$coy/autorespond-msg-subj-".$market.".txt"); $autorespondsubj = ob_get_contents(); ob_clean(); //eval("\$body = \"$body\";"); if ($emailaddress) { mail($emailaddress, "$fname, welcome to the $brand Website!", $body, "From: $brand<$adminemail>\nX-Mailer: PHP/" . phpversion()); mail($emailaddress, $autorespondsubj, $autorespond, "From: $referrafname<$referralemail>\nCc:$referralemail\n$X-Mailer: PHP/" . phpversion()); } else mail("affiliates@onlinesrs.com", "Error: emailaddress is Empty!", $body, "From: $brand<$adminemail>\nX-Mailer: PHP/" . phpversion()); if ($referer) $referer = "Visit from ".$referer; ob_start(); IncludeFile("text/$coy/visitor-msg-".$market.".txt"); $body = ob_get_contents().$body; ob_clean(); if ($referralemail) { if (trim($referralemail) == trim($emailaddress)) { // $body = "Hello,\n\nEither you or someone using the same email as yours has visited your rebranded website. This is just a notification, no action is needed.\n\nRegards\n$brand Team\nhttp://www.onlinesrs.com/forum\n"; // mail("affiliates@onlinesrs.com", "Error: Referralemail is the same as Emailaddress!!!", $body, "From: $brand<$adminemail>\nX-Mailer: PHP/" . phpversion()); } mail($referralemail, "$brand.com Website Visit : $fname", $body, "From: $brand<$adminemail>\nBcc: affiliates@onlinesrs.com\nX-Mailer: PHP/" . phpversion()); } else mail("hans@onlinesrs.com", "Error: Referralemail is Empty!", $body, "From: $brand<$adminemail>\nX-Mailer: PHP/" . phpversion()); } include("header.htm"); ?>