debug = TRUE; $db->setTable("contestants"); if (!$firstname) { $err = "You must enter your first name"; } elseif (!$lastname) { $err = "You must enter your last name"; } elseif (!preg_match(':.+@.+\..+:',$email)) { $err = "You must enter a valid email address (user@domain.com)"; } elseif (!preg_match("/[0-9A-Z_\.-]+@[0-9A-Z\-]+\.\w+/i", $email)) { $err = "Your email must be in the form 'user@somewhere.com'"; } elseif (!$city || !$state || !$zip) { $err = "You must enter your city, state, and zip"; } elseif (strlen($ssn) < 4) { $err = "You must enter the last 4 digits of your SSN"; } elseif (!$username) { $err = "You must choose a username"; } elseif (preg_match("/[^\w\d]/", $username)) { $err = "Your username can only contain letters and numbers"; } elseif (strlen($username) < 6) { $err = "Your username is too short"; } elseif ($db->exists("username", $username)) { $err = "Sorry, but the username '$username' is already taken

Please keep in mind that all accounts are still active from last contest. If this was your username from last contest, you simply have to log in!"; } elseif ($db->exists("email", $email, 'contestant_info')) { $err = "Sorry, but that email address is already in our system

Please keep in mind that all accounts are still active from last contest. If you had a username from last contest, you simply have to log in!"; } elseif (!$password) { $err = "You must choose a password"; } elseif (strlen($password) < 6) { $err = "Your password is too short"; } elseif (!$passwordconf) { $err = "You must re-type your password"; } elseif ($password != $passwordconf) { $err = "Your passwords do not match"; } elseif (!$agree) { $err = "You must assert that you agree to the rules"; } else { // Everything OK! $code = ""; mt_srand((double) microtime() * 1000000); while (strlen($code) < 4) { $c = chr(mt_rand(48,150)); if (ereg("^[0-9]$", $c)) $code .= $c; } $code = strtolower($code); $db->execute("INSERT INTO contestants (username, password, confcode) values ('$username','$password','$code')"); $id = mysql_insert_id($db->getConn()); $db->execute("INSERT INTO contestant_info (uid, firstname, lastname, email, phone, address, city, state, zip, country, ssn) values ($id,'$firstname','$lastname','$email','$phone','$address','$city','$state','$zip','$country','$ssn')"); $body = "Dear $firstname,\n\nYou will now need to confirm your contest enrollment with the following info:\n\nUsername: $username\nConf Code: $code\n\nPlease visit http://www.santaanita.com/showvivor/conf.php to confirm your registration.\n\nGood luck!\n\nSanta Anita Park"; mail("\"$firstname $lastname\" <$email>", "Santa Anita Online Contest", $body, "From: Santa Anita Park "); } } if (time() >= strtotime("$cutoffDate 12:45 pm") || $isTooLate && !$bypass) { $toolate = 1; } ?>

Contest Registration

Registration ended at .

'. $err . '

'; } ?>
First Name:
Last Name:
Email:
Phone:
Address:
City:
State:
Zip:
Country:
Last 4 digits
of SSN:
Username
Password:
Re-type:
I have read, understand, and have agreed to all the rules regarding the contest.

Thank you for registering for the contest. An email has been sent to '' with confirmation instructions. Good luck!