$value) $$var = $value; foreach($_GET as $var => $value) $$var = $value; foreach($_POST as $var => $value) $$var = $value; foreach($_COOKIE as $var => $value) $$var = $value; foreach($_SERVER as $var => $value) $$var = $value; ob_start(); function randomkeys($length) { $pattern = "1234567890abcdefghijklmnopqrstuvwxyz"; for($i=0;$i<$length;$i++) { $key .= $pattern{rand(0,35)}; } return $key; } if (isset($_POST['ausername'])) { $usercode = $_POST['ausername']; } else { $usercode = randomkeys(16); } $errorMsg = ''; if($_POST['commited'] == 'yes') { // form was sent mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 8)"); if($_POST['ausername'] == '') $errorMsg .= $AFF_SI_UNAMEMISSING.'
'; // check if user doesnt exist already $userid = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['ausername']); // protect against sql injection $chk_user = mysql_db_query($database, "select refid from affiliates where refid='$userid'"); if(mysql_num_rows($chk_user) > 0) { $errorMsg .= $AFF_SI_USEREXISTS.'
'; $_POST['ausername'] = ''; } if($_POST['apassword'] == '') $errorMsg .= $AFF_SI_PWDMISSING.'
'; if($_POST['awebsite'] == '') $errorMsg .= $AFF_SI_URLMISSING.'
'; if($_POST['aemail'] == '') $errorMsg .= $AFF_SI_EMAILMISSING.'
'; if($errorMsg == '') { // save and send notification email $aemailbody = "" . $Dear . "".$_POST['afirstname'].",\n\n" . $Thank_you_signingup . "\n" . $Your_account_details . "\n\n" ."" . $AFF_G_AFFID . "" . $dots . "".$_POST['ausername']."\n" . $AFF_G_PASSWORD . "" . $dots . "".$_POST['apassword']."\n\n" ."" . $You_can_loginto_your_account . "\n" ."http://".$domain."/affiliates/user/index.php\n\n" ."" . $Thank_you . "\n\n\n" ."" . $AFF_A_AFFILIATE . "" . $Management . "\n" .$_POST['emailinfo']."\n\n\n\n"; mysql_db_query($database, "INSERT INTO affiliates VALUES ('".$_POST['ausername']."', '".$_POST['apassword']."', '".$_POST['acompany']."', '".$_POST['atitle']."', '".$_POST['afirstname']."', '".$_POST['alastname']."', '".$_POST['awebsite']."', '".$_POST['aemail']."', '".$_POST['apayable']."', '".$_POST['astreet']."', '".$_POST['atown']."', '".$_POST['acounty']."', '".$_POST['apostcode']."', '".$_POST['acountry']."', '".$_POST['aphone']."', '".$_POST['afax']."', '".$_POST['adate']."')") or die(mysql_error()); include "thankyou.php"; mail($_POST['aemail'], "Welcome New Affiliate!", $aemailbody, "From:".$emailinfo."\nReply-To:".$emailinfo."\n"); exit; } } include "header.php"; ?>

" . $Error . "

$errorMsg

"; ?>