session_start();
session_register("affiliateid");
session_register("affiliatecampaign");
session_register("turingnumber");
include("includes/CountrySelectBox.inc.php");
include("includes/IndustrySelectBox.inc.php");
include("includes/databaseconnect.php");
include("includes/email.inc.php");
include('includes/htmlMimeMail.php');
include("includes/emailtemplate.inc.php");
include("includes/process_parents.inc.php");
include("includes/process_notifications.inc.php");
$tmstamp = date("YmdHis");
if(!isset($pageid)) { $pageid=0; }
##############################################
######## PERSONAL ACCOUNT PROCESSING ########
if($pageid=="4") {
$question = stripslashesandquotes($question);
$answer = stripslashesandquotes($answer);
$email=stripslashesandquotes($email);
$firstname=stripslashesandquotes($firstname);
$lastname=stripslashesandquotes($lastname);
$phone=stripslashesandquotes($phone);
$lastname=stripslashesandquotes($lastname);
$address1=stripslashesandquotes($address1);
$address2=stripslashesandquotes($address2);
$city=stripslashesandquotes($city);
$state=stripslashesandquotes($state);
$zip=stripslashesandquotes($zip);
$country=stripslashesandquotes($country);
$email=stripslashesandquotes($email);
$city=stripslashesandquotes($city);
$todaydate=date("Ymd");
$ip=getenv(REMOTE_ADDR);
$activationcode=md5(microtime().posix_getpid());
if(strlen($affiliateid)==0) {
$affiliateid=0;
if(!isset($HTTP_COOKIE_VARS['affiliateid'])) {
$affiliateid=$HTTP_COOKIE_VARS['affiliateid'];
}
if(!isset($HTTP_COOKIE_VARS['affiliatecampaign'])) {
$affiliatecampaign=$HTTP_COOKIE_VARS['affiliatecampaign'];
}
}
if($sentmoney=="1") {
$sql="UPDATE customers set firstname='$firstname', lastname='$lastname', address1='$address1', address2='$address2', city='$city', state='$state', zip='$zip', country='$country', url='$url', phone='$phone', email='$email', password='$password1', securityq='$question', securitya='$answer', activationcode='$activationcode', activated='0', ip='$ip', merchant='$merchant', verified='0', created='$todaydate', affiliatecampaign='$affiliatecampaign' where customerid='$existingcustomerid';";
$re=mysql_query($sql);
} else {
#insert record
$sql="INSERT INTO `customers` ( `customerid` , `parent1`, `firstname` , `lastname` , `address1` , `address2` , `city` , `state` , `zip` , `country` , `url` , `phone` , `email` , `businessemail`, `password` , `securityq` , `securitya` , `activationcode` , `activated` , `ip` , `verified`, `created`, `affiliatecampaign` ) ";
$sql.="VALUES ( '', '$affiliateid', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$url', '$phone', '$email', '$email', '$password1', '$question', '$answer', '$activationcode', '0', '$ip', '0', '$todaydate', '$affiliatecampaign' );";
mysql_query($sql);
$sql2="select customerid from customers where `email`='$email'";
$rs2=mysql_query($sql2);
$num2=mysql_num_rows($rs2);
if($num2!=0) {
$customerid=mysql_result($rs2,0,"customerid");
### generate customer's 5-level parent information if their parent1!=0
if($affiliateid!=0) { process_parents($customerid, $affiliateid); }
} else {
#record did not get inserted!!!
mail("accounts@phoenix-pay.com", "signup failed", $sql);
echo startpage($tmstamp);
echo "
We are sorry!
Your signup did not complete successfully. We have been notified and will contact you within 24 hours to let you know we have fixed the problem.
";
endpage($affiliateid, $affiliatecampaign);
exit();
}
}
$username = $firstname." ".$lastname;
send_verification_email($firstname, $lastname, $email, $activationcode);
if(strlen($affiliateid)>0) {
send_affiliate_signup_email($affiliateid, $affiliatecampaign, $tmstamp, $firstname, $lastname, $email);
}
echo startpage($tmstamp);
?>
You are almost done!
We just sent an email to you at: .
To confirm your registration, please open that
message and click on the special link contained in it.
endpage($affiliateid, $affiliatecampaign);
}
##############################################
######## BUSINESS ACCOUNT PROCESSING ########
if($pageid=="5") {
$businessname=stripslashesandquotes($businessname);
$keyword1=stripslashesandquotes($keyword1);
$keyword2=stripslashesandquotes($keyword2);
$keyword3=stripslashesandquotes($keyword3);
$keyword4=stripslashesandquotes($keyword4);
$keyword5=stripslashesandquotes($keyword5);
$keyword6=stripslashesandquotes($keyword6);
$businessaddress1=stripslashesandquotes($businessaddress1);
$businessaddress2=stripslashesandquotes($businessaddress2);
$businesscity=stripslashesandquotes($businesscity);
$businessstate=stripslashesandquotes($businessstate);
$businesszip=stripslashesandquotes($businesszip);
$country=stripslashesandquotes($country);
$businessemail=stripslashesandquotes($businessemail);
$businessphone=stripslashesandquotes($businessphone);
$businessurl=stripslashesandquotes($businessurl);
$firstname=stripslashesandquotes($firstname);
$lastname=stripslashesandquotes($lastname);
$phone=stripslashesandquotes($phone);
$lastname=stripslashesandquotes($lastname);
$address1=stripslashesandquotes($address1);
$address2=stripslashesandquotes($address2);
$city=stripslashesandquotes($city);
$state=stripslashesandquotes($state);
$zip=stripslashesandquotes($zip);
$email=stripslashesandquotes($email);
$city=stripslashesandquotes($city);
$question = stripslashesandquotes($question);
$answer = stripslashesandquotes($answer);
$todaydate=date("Y")."-".date("m")."-".date("d");
$ip=getenv(REMOTE_ADDR);
$activationcode=md5(microtime().posix_getpid());
if(strlen($affiliateid)==0) {
$affiliateid=0;
if(!isset($HTTP_COOKIE_VARS['affiliateid'])) {
$affiliateid=$HTTP_COOKIE_VARS['affiliateid'];
}
if(!isset($HTTP_COOKIE_VARS['affiliatecampaign'])) {
$affiliatecampaign=$HTTP_COOKIE_VARS['affiliatecampaign'];
}
}
if($sentmoney=="1") {
$sql="UPDATE customers set firstname='$firstname', lastname='$lastname', address1='$address1', address2='$address2', city='$city', state='$state', zip='$zip', country='$country', url='$url', phone='$phone', email='$email', password='$password1', securityq='$question', securitya='$answer', businessname='$businessname', businessaddress1='$businessaddress1', businessaddress2='$businessaddress2', businesscity='$businesscity', businessstate='$businessstate', businesszip='$businesszip', businessemail='$businessemail', businessphone='$businessphone', businessurl='$businessurl', activationcode='$activationcode', activated='0', ip='$ip', merchant='$merchant', verified='0', created='$todaydate', affiliatecampaign='$affiliatecampaign', merchant='1' where customerid='$existingcustomerid';";
$re=mysql_query($sql);
} else {
$sql="INSERT INTO `customers` ( `customerid` , `parent1`, `firstname` , `lastname` , `address1` , `address2` , `city` , `state` , `zip` , `country` , `url` , `phone` , `email` , `password` , `securityq` , `securitya` , `businessname`,`businessaddress1`,`businessaddress2`,`businesscity`,`businessstate`,`businesszip`,`businessemail`,`businessphone`,`businessurl`,`activationcode` , `activated` , `ip` , `verified`, `created`, `affiliatecampaign`, `merchant` ) ";
$sql.="VALUES ( '', '$affiliateid', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$url', '$phone', '$email', '$password1', '$question', '$answer', '$businessname','$businessaddress1','$businessaddress2','$businesscity','$businessstate','$businesszip','$businessemail','$businessphone','$businessurl','$activationcode', '0', '$ip', '0', '$todaydate', '$affiliatecampaign', '1' );";
$re=mysql_query($sql);
}
add_keywords_to_record($email, $keyword1, $keyword2, $keyword3, $keyword4, $keyword5, $keyword6);
$username = $firstname." ".$lastname;
send_verification_email($firstname, $lastname, $email, $activationcode);
if(strlen($affiliateid)>0) {
send_affiliate_signup_email($affiliateid, $affiliatecampaign, $tmstamp, $firstname, $lastname, $email);
}
echo startpage($tmstamp);
?>
You are almost done!
We just sent an email to you at:
Please click on the link you find inside the email to confirm your registration.
endpage($affiliateid, $affiliatecampaign);
}
##################################################
########### VALIDATE PERSONAL FORM #################
if(isset($submitpage1)) {
$arr = array();
$sentmoney=0;
$iserror=0;
#check first name field filled in
if(strlen($firstname)<1) {
$iserror=1;
$arr[]=1;
}
#check lastname field filled in
if(strlen($lastname)<1) {
$iserror=1;
$arr[]=2;
}
#check address fields filled in
if(strlen($address1)<6 || strlen($city)<2) {
$iserror=1;
$arr[]=3;
}
#check state
if(strlen($state)==0) {
$iserror=1;
$arr[]=4;
}
#check country
if(strlen($country)<2) {
$iserror=1;
$arr[]=5;
}
#check phone number
if(strlen($phone)<6) {
$iserror=1;
$arr[]=6;
}
#check email too short
if(strlen($email)<6) {
$iserror=1;
$arr[]=7;
} else {
#check email address used before
if($iserror==0) {
$sql="select customerid, moneywaiting, activated from customers where email='$email';";
$rs=mysql_query($sql);
$num=mysql_num_rows($rs);
if($num!=0) {
$moneywaiting=mysql_result($rs,0,"moneywaiting");
$activated=mysql_result($rs,0,"activated");
$customerid=mysql_result($rs,0,"customerid");
if($moneywaiting==1 && $activated==0) {
#customer's been sent money and is now signing up
$sentmoney=1;
$existingcustomerid=$customerid;
} else {
#customer is already in database
$iserror=1;
$arr[]=8;
}
}
}
}
#check password too short
if(strlen($password1)<6) {
$iserror=1;
$arr[]=9;
} else {
#check password confirmation
if($password1!=$confirm) {
$iserror=1;
$arr[]=10;
}
}
#check security question
if(strlen($question)<1) {
$iserror=1;
$arr[]=11;
}
#check security answer
if(strlen($answer)<1) {
$iserror=1;
$arr[]=12;
}
#check conditions box ticked
if($conditions!="on") {
$iserror=1;
$arr[]=13;
}
if($turingnumber!=$turinganswer) {
$iserror=1;
$arr[]=14;
}
if($iserror!=0) { $pageid=1; } else { $pageid=2; }
}
#####################################
####### validate business form ######
if(isset($submitpage2)) {
$arr = array();
$sentmoney=0;
$iserror=0;
#check businessname field filled in
if(strlen($businessname)<1) {
$iserror=1;
$arr[]=1;
}
#check business address fields filled in
if(strlen($businessaddress1)<5 || strlen($businesscity)<2) {
$iserror=1;
$arr[]=3;
}
#check businessstate
if(strlen($businessstate)==0) {
$iserror=1;
$arr[]=4;
}
#check businesszip
if(strlen($businesszip)==0) {
$iserror=1;
$arr[]=5;
}
#check businessemail
if(strlen($businessemail)<2) {
$iserror=1;
$arr[]=6;
}
#check first name field filled in
if(strlen($firstname)<1) {
$iserror=1;
$arr[]=9;
}
#check lastname field filled in
if(strlen($lastname)<1) {
$iserror=1;
$arr[]=10;
}
#check lastname field filled in
if(strlen($phone)<1) {
$iserror=1;
$arr[]=11;
}
#check email too short
if(strlen($email)<6) {
$iserror=1;
$arr[]=15;
} else {
#check email address used before
if($iserror==0) {
$sql="select customerid, moneywaiting, activated from customers where email='$email' or `businessemail`='$email';";
$rs=mysql_query($sql);
$num=mysql_num_rows($rs);
if($num!=0) {
$moneywaiting=mysql_result($rs,0,"moneywaiting");
$activated=mysql_result($rs,0,"activated");
$customerid=mysql_result($rs,0,"customerid");
if($moneywaiting==1 && $activated==0) {
#customer's been sent money and is now signing up
$sentmoney=1;
$existingcustomerid=$customerid;
} else {
#customer is already in database
$iserror=1;
$arr[]=16;
}
}
}
}
#check password too short
if(strlen($password1)<6) {
$iserror=1;
$arr[]=17;
} else {
#check password confirmation
if($password1!=$confirm) {
$iserror=1;
$arr[]=18;
}
}
#check security question
if(strlen($question)<1) {
$iserror=1;
$arr[]=19;
}
#check security answer
if(strlen($answer)<1) {
$iserror=1;
$arr[]=20;
}
#check conditions box ticked
if($conditions!="on") {
$iserror=1;
$arr[]=21;
}
if($turingnumber!=$turinganswer) {
#$iserror=1;
#$arr[]=22;
}
if($iserror!=0) { $pageid=1; } else { $pageid=3; }
}
########################################################
############ PREVIEW PAGE FOR PERSONAL ACCOUNT #########
if($pageid==2) {
echo startpage($tmstamp);
$question = stripslashesandquotes($question);
$answer = stripslashesandquotes($answer);
$businessemail=stripslashesandquotes($email);
$firstname=stripslashesandquotes($firstname);
$lastname=stripslashesandquotes($lastname);
$phone=stripslashesandquotes($phone);
$lastname=stripslashesandquotes($lastname);
$address1=stripslashesandquotes($address1);
$address2=stripslashesandquotes($address2);
$city=stripslashesandquotes($city);
$state=stripslashesandquotes($state);
$zip=stripslashesandquotes($zip);
$country=stripslashesandquotes($country);
$email=stripslashesandquotes($email);
$city=stripslashesandquotes($city);
?>
Please confirm the data you entered |
First Name | |
Last Name | |
Address 1 | |
Address 2 | |
City | |
State/Province | |
Zip/Postal Code | |
Country | |
Phone Number | |
Email | |
Security Question | |
Security Answer | |
endpage($affiliateid, $affiliatecampaign);
}
########################################################
############ PREVIEW PAGE FOR business ACCOUNT #########
if($pageid==3) {
echo startpage($tmstamp);
$question = stripslashesandquotes($question);
$answer = stripslashesandquotes($answer);
$businessname=stripslashesandquotes($businessname);
$keyword1=stripslashesandquotes($keyword1);
$keyword2=stripslashesandquotes($keyword2);
$keyword3=stripslashesandquotes($keyword3);
$keyword4=stripslashesandquotes($keyword4);
$keyword5=stripslashesandquotes($keyword5);
$keyword6=stripslashesandquotes($keyword6);
$businessaddress1=stripslashesandquotes($businessaddress1);
$businessaddress2=stripslashesandquotes($businessaddress2);
$businesscity=stripslashesandquotes($businesscity);
$businessstate=stripslashesandquotes($businessstate);
$businesszip=stripslashesandquotes($businesszip);
$country=stripslashesandquotes($country);
$businessemail=stripslashesandquotes($businessemail);
$businessphone=stripslashesandquotes($businessphone);
$businessurl=stripslashesandquotes($businessurl);
$firstname=stripslashesandquotes($firstname);
$lastname=stripslashesandquotes($lastname);
$phone=stripslashesandquotes($phone);
$lastname=stripslashesandquotes($lastname);
$address1=stripslashesandquotes($address1);
$address2=stripslashesandquotes($address2);
$city=stripslashesandquotes($city);
$state=stripslashesandquotes($state);
$zip=stripslashesandquotes($zip);
$email=stripslashesandquotes($email);
$city=stripslashesandquotes($city);
?>
Please confirm the data you entered |
Business Name | |
Keywords | |
Business Address 1 | |
Business Address 2 | |
Business City | |
Business State/Province | |
Business Zip/Postal Code | |
Business Country | |
Customer service email | |
Customer service phone | |
Business URL | |
First Name | |
Last Name | |
Phone Number | |
Address 1 | |
Address 2 | |
City | |
State/Province | |
Zip/Postal Code | |
Country | |
Email | |
Security Question | |
Security Answer | |
endpage($affiliateid, $affiliatecampaign);
}
if($pageid==1) {
startpage($tmstamp);
if(strlen($url)==0) { $url="http://"; }
##################################################
########### BUSINESS SIGNUP FORM #################
if($account_type==1) {
if($iserror!=0) {
echo errorbox2($arr);
}
?>
} else {
##################################################
########### PERSONAL SIGNUP FORM #################
if($iserror!=0) {
echo errorbox1($arr);
}
?>
}
endpage($affiliateid, $affiliatecampaign);
}
if($pageid==0) {
startpage($tmstamp);
?>