'; // check if user doesnt exist already $userid = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['ausername']); // protect against sql injection $chk_user = mysql_query("SELECT Username FROM Affiliates where Username='$userid'"); if(mysql_num_rows($chk_user) > 0) { $errorMsg .= AFF_SI_USEREXISTS.'
'; $_POST['ausername'] = ''; } if($_POST['apassword'] == '') $errorMsg .= AFF_SI_PWDMISSING.'
'; if($_POST['aemail'] == '') $errorMsg .= AFF_SI_EMAILMISSING.'
'; $email = $_POST['aemail']; if(!sa_valid_email($_POST['aemail'])) $errorMsg .= AFF_SI_EMAILINVALID.'
'; if($_POST['termsAgree'] == "no") $errorMsg .= AFF_SI_TERMSNO.'
'; if($errorMsg == '' && (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"]))){ // save and send notification email $aemailbody = "Dear ".$_POST['afirstname'].",\n\nThank you for signing up to our affiliate program.\nYour account details are below:\n\n" ."Username: ".$_POST['ausername']."\nPassword: ".$_POST['apassword']."\n\n" ."You can log into your account and view your 'real-time' statistics by going to:\n" ."http://".$domain."/".$folder."/user/index.php\n\n" ."Thank you once again, and we wish you luck with your profit making!\n\n\n" ."Affiliate Program Manager\n" .$adminEmail."\n\n\n\n"; $date_now = date("U"); $password = md5($_POST['apassword']); $q1 = mysql_query("INSERT INTO Affiliates (Username, Password, FirstName, LastName, Company, Street, Street2, City, State, Zip, Country, Phone, Email, Website, PayTo, Title, PaymentPreferenceID, StartEffectiveDate, EndEffectiveDate) VALUES ('".$_POST['ausername']."', '".$password."', '".$_POST['afirstname']."', '".$_POST['alastname']."', '".$_POST['acompany']."', '".$_POST['astreet']."', '".$_POST['astreet2']."', '".$_POST['acity']."', '".$_POST['astate']."', '".$_POST['azip']."', '".$_POST['acountry']."', '".$_POST['aphone']."', '".$_POST['aemail']."', '".$_POST['awebsite']."', '".$_POST['acheckname']."', '".$_POST['atitle']."', '".$_POST['payPreference']."', '".$date_now."', '2145945600')") or die(mysql_error()); include "thankyou.php"; if(!mail($_POST['aemail'], "Welcome New Affiliate!", $aemailbody, "From:".$adminEmail."\nReply-To:".$adminEmail."\n")){ echo "
Mail Delivery to New Affiliate Failed.
"; } $aemailbody .= "The above message was sent to the new affiliate."; if(!mail($adminEmail, "We have a New Affiliate!", $aemailbody, "From:".$adminEmail."\nReply-To:".$adminEmail."\n")){ echo "
Mail Delivery Failed.
"; } exit; } } include "header.php"; ?>


$errorMsg

"; ?>
Affiliate Signup
Title:  
First Name:  
Last Name:  
Payment Prference PayPal :: Check  
Pay To: Paypal Email Address or Name to Make Checks out to.
Company:  
Website Address:  
Email Address: *  
Street Address:  
Street Address 2:  
City:  
State:  
PostCode:  
Country:  
Phone:  
Choose Username: *  
Choose Password: *  
AFF_SI_TERMS

I agree. OR I DO NOT agree.