session_start();
include "../affconfig.php";
include "./lang/$language";
include "./countries.php";
$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($affdatabase, "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['aemail'] == '')
$errorMsg .= AFF_SI_EMAILMISSING.'
';
if($errorMsg == '')
{
// save and send notification email
$aemailbody = "Dear ".$_POST['afirstname'].",\n\nThank you for signing up to our Community Group 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."/user/index.php\n\n"
."Thank you once again, and we wish you luck with your fund raising!\n\n\n"
."Community Group Manager\n"
.$_POST['emailinfo']."\n\n\n\n";
mysql_db_query($affdatabase, "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 Community Group!", $aemailbody, "From:".$emailinfo."\nReply-To:".$emailinfo."\n");
exit;
}
}
include "header.php";
?>
Community Group Signup
if($errorMsg != '') echo "$errorMsg
"; ?>