register - <?php //Make sure we can connect to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: <?php //Make sure we can connect to the database session_start(); require 'tribaldb.php'; r if($_POST['register']){ echo "<font color=red><center><b>"; //Get user input, add slashed keeps SQL injection out $first = addslashes($_POST['firstname']); $middle = addslashes($_POST['middleinit']); $last = addslashes($_POST['lastname']); $email = addslashes($_POST['email']); $department = addslashes($_POST['Agencyid']); $agency = addslashes($_POST['Serviceid']); $govcorp = addslashes($_POST['emptype']); $compname = addslashes($_POST['Company']); $otherdesc = addslashes($_POST['Other']); $tribe = addslashes($_POST['tribe']); $regdate = date("F j, Y, g:i a"); $ //Get the last 3,4,5 letters of the email for extension checks $end3 = substr($email, -3); $end4 = substr($email, -4); $end5 = substr($email, -5); $ if(!$first){ echo "You need to input a first name!"; }elseif(!$email){ echo "You need to input an email!"; }elseif(!$last){ echo "You need to input a last name!"; }elseif(!$govcorp){ echo "Choose a listing!"; e }elseif($end4 != ".com" AND $end4 != ".org" AND $end4 != ".mil" AND $end4 != ".edu" AND $end4 != ".gov" AND $end4 != ".net" AND $end4 != ".biz" AND $end3 != ".us" AND $end5 != ".mobi" AND $end5 != ".name" AND $end5 != ".info"){ echo "You need to input a valid email address! If you are sure your email is valid please use another email."; }elseif(!ereg("@", $email)) { echo "Your email does not have an @ symbol, and thus must be false."; }elseif($govcorp == "Federal" && $department == "100") { echo "Please specify which department you are from."; }elseif($govcorp == "Federal" && $agency==""){ echo "Please specify your agency."; }elseif($govcorp == "Contractor" && $compname == "") { echo "Please specify which company you are from."; }elseif($govcorp == "Tribe Member" && $tribe == "0") { echo "Please specify which tribe you are from."; }elseif($govcorp == "Other" && $otherdesc == "") { echo "Please specify other."; }else { } //Check if the email is in use $echeck = mysql_query("SELECT id FROM users WHERE email='$email'"); $check = mysql_num_rows($echeck); $ //If it is throw error if($check > 0){ echo "That email is already in use!"; }else { //Thanks to whoever made the damn select box have numbers we have to do things the hard way. $departments = array("Other departments","Air Force","Air Force Intelligence Agency","Air Force Medical Command","Army","Army Intelligence and Security Command","Army Medical Command","Centers for Medicare and Medicaid Services","Central Intelligence Agency","Defense Intelligence Agency","Defense Logistics Agency","Department of Agriculture","Department of Commerce","Department of Defense","Department of Education","Department of Energy","Department of Health and Human Services","Department of Housing and Urban Development","Department of the Interior","Department of Justice","Department of Labor","Department of State","Department of Transportation","Department of Treasury","Environmental Protection Agency","Equal Employment Opportunity Commission","Executive Office of...
View Full Document

This note was uploaded on 07/28/2009 for the course PHP 1 taught by Professor F during the Spring '09 term at Anne Arundel CC.

Page1 / 32

register - <?php //Make sure we can connect to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online