if($reg==="yes")
{ ////do the data qualify routines
if(!$fname){$msg.="*** Please provide your first name
";}
if(!$lname){$msg.="*** Please provide your last name
";}
if(!$email){$msg.="*** Please provide your email address
";}
if($email){////check the email address
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {$msg.="*** Please provide a good email address
";}
}//EOR check the email address
if(!$address){$msg.="*** Please provide your mailing address
";}
if(!$city){$msg.="*** Please provide the city you reside in
";}
if(!$state){$msg.="*** Please provide the state you reside in
";}
if(!$country){$msg.="*** Please provide the country you reside in
";}
if(!$zip){$msg.="*** Please provide your postal code
";}
if(!$phone){$msg.="*** Please provide your main phone number
";}
if(!$edition){$msg.="*** Please provide which edition you are registering
";}
if($edition==="third")
{///make sure the ID is good
//echo"yup';exit;
if(!$f3){$msg.="*** Please provide the Nerdbook® ID code
";}
if(!$s3){$msg.="*** Please provide the Nerdbook® ID code
";}
/*if(!$t3){$msg.="*** Please provide the Nerdbook® ID code
";}*/
/*if($f3){if($f3<>"978" && $f3 <> "200"){$msg.="*** Please correct the Nerdbook® ID code
";}}*/
if($f3){if($f3<>"978" && $f3 <> "200" && $f3 <> "928"){$msg.="*** Please correct the Nerdbook® f3 ID code
";}}
if($f3){if($s3<>"096" && $s3 <> "702" && $s3 <> "703"&& $s3 <> "010"){$msg.="*** Please correct the Nerdbook® s3 ID code
";}}
/*if($f3){if($s3<>"096" && $s3 <> "702" && $s3 <> "703"){$msg.="*** Please correct the Nerdbook® ID code
";}}*/
/*if($f3){if($t3<>"0071"){$msg.="*** Please correct the Nerdbook® ID code
";}}*/
}///EORmake sure the ID is good
if(!$heard){$msg.="*** Please tell us how you first heard of Nerdbook®
";}
///////////////all good data Routine
if(!$msg){
///check for dupes
require("../sophia/database/connect.php");
mysql_select_db(nerdbook_com);
$result = mysql(nerdbook_com, "select * from newreg where email = '$email' and edition = '$edition'");
$num_results = mysql_num_rows($result);
if($num_results > 0 ){$msg.="*** This email has already been used to register a Nerdbook $edition Edition, please change the email or edition.
";}
}//EOR///////////////all good data Routine
if(!$msg){//////ALL GOOD - NO DUPES - LETS DO IT//////////////////////////////////////
///gen pass
$str = '';
for ($i=1; $i<=8; $i++){
$set = array(rand (65,90),rand(97,122));
$str .= chr($set[rand(0,1)]);
}
$password=$str;
$str = '';
for ($i=1; $i<=25; $i++){
$set = array(rand (65,90),rand(97,122));
$str .= chr($set[rand(0,1)]);
}
$actKey=$str;
//echo"$actKey";exit;
///EOR gen pass
//add slashes
$fname=addslashes($fname);
$lname=addslashes($lname);
$email=addslashes($email);
$address=addslashes($address);
$city=addslashes($city);
$state=addslashes($state);
$country=addslashes($country);
$zip=addslashes($zip);
$phone=addslashes($phone);
$edition=addslashes($edition);
$heard=addslashes($heard);
$schoolyear=addslashes($schoolyear);
$school=addslashes($school);
$yeargrad=addslashes($yeargrad);
$other=addslashes($other);
////get access data
if (getenv(HTTP_X_FORWARDED_FOR)){
$ip=getenv(HTTP_X_FORWARDED_FOR);
}
else {
$ip=getenv(REMOTE_ADDR);
}
$rhost = @gethostbyaddr($REMOTE_ADDR);
$useragent = getenv('HTTP_USER_AGENT');
///Get date and time
$rdate=date('Ymd');
$rtime=date('H:i:s');
////input record
$regCode=$f3.$s3;
$sql="INSERT INTO `newreg` (`regID`, `fname`, `lname`, `email`, `address`, `city`, `state`, `country`, `zip`, `phone`, `edition`, `heard`, `schoolyear`, `school`, `practiceyears`, `yeargrad`, `other`, `ip`, `rhost`, `useragent`, `rdate`, `rtime`, `password`, `regCode`, `actKey`, `status`) VALUES ('', '$fname', '$lname', '$email', '$address', '$city', '$state', '$country', '$zip', '$phone', '$edition', '$heard', '$schoolyear', '$school', '$practiceyears', '$yeargrad', '$other', '$ip', '$rhost', '$useragent', '$rdate', '$rtime', '$password', '$regCode', '$actKey', 'Pendind')";
if(!mysql_query($sql)){echo"Failed to add record and stopped";exit;}
/*
$sql="INSERT INTO `newreg` (`regID`, `fname`, `lname`, `email`, `address`, `city`, `state`, `country`, `zip`, `phone`, `edition`, `heard`, `schoolyear`, `school`, `practiceyears`, `yeargrad`, `other`, `ip`, `rhost`, `useragent`, `rdate`, `rtime`, `password`, `actKey`, `status`) VALUES ('', '$fname', '$lname', '$email', '$address', '$city', '$state', '$country', '$zip', '$phone', '$edition', '$heard', '$schoolyear', '$school', '$practiceyears', '$yeargrad', '$other', '$ip', '$rhost', '$useragent', '$rdate', '$rtime', '$password', '$actKey', 'Pending')";
if(!mysql_query($sql)){echo"Failed to add record and stopped";exit;}*/
////Send email
if($edition==='third'){
$subject = "Nerdbook Registration";
$message = "
Nerdbook Registration Activation Email
 |
| Nerdbook 3rd Edition Registration Activation |
Hello $fname $lname,
Thank you for registering the Nerdbook 3rd Edition.
In appreciation, we have extended a FREE Nerdbook Extras area for your use.
In order to take advantage of this resource your need to activate your registration by clicking here.
Once activated you will be given full access to the additional resources.
Thanks again,
Dr. Sophia Yin
Cattledog Publishing |
|
 |
";
$headers = "MIME-Version: 1.0\n";
$headers .="Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Mailer: PHP4\n"; //mailer
$headers .="X-Priority: 3 (Normal)\n";
//$headers .="Disposition-Notification-To: \"$em\" <$name>\n";
$headers .="From: Nerdbook Registration\n";
mail($email, $subject, $message, $headers);
}///EOR Send Email for third edition
header("Location: thanksreg.php?edition=$edition");exit;
}//////EOR ALL GOOD - NO DUPES - LETS DO IT///////////////////////////////////////////
}////EOR do the data qualify routines
?>
include_once('borders/border_class.php');
$pmb = new PhpMyBorder(false);
?>
Registration Form
include("../menu3/m3_final.php");?>
 |
Please provide the following information to register your Nerdbook®.
if ($msg){echo"
 |
$msg |
 |
";} ?>
indicates required information. |
|
|
|
|
//echo $pmb -> end_shadow(); ?>