require_once('mysql_connect.php');//Connect to the database.
if(isset($_POST['submit'])) { //Handle the registration form.
//Validate the username, first_name, last_name, password, email, city, state, zip and picture for member registration.
//Check for a the first_name
if (eregi("^[[:alpha:].' -]{2,15}$", stripslashes(trim($_POST['first_name'])))){
$fn = $_POST['first_name'];
}else{
$fn = FALSE;
echo '<p><font color="red">Please enter your first name!</font></p>';
}
//Check for a the last_name
if (eregi("^[[:alpha:].' -]{2,15}$", stripslashes(trim($_POST['last_name'])))){
$ln = $_POST['last_name'];
}else{
$ln = FALSE;
echo '<p><font color="red">Please enter your last name!</font></p>';
}
//Check for a the email address
//if (eregi("^[[:alnum:]]{a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$",
//stripslashes(trim($_POST['email'])))){
$em = $_POST['email'];
//}else{
//$em = FALSE;
//echo '<p><font color="red">Please enter your email address!</font></p>';
//}
//Check for a the username
if (eregi("^[[:alnum:]_]{4,20}$", stripslashes(trim($_POST['username'])))){
$un = $_POST['username'];
}else{
$un = FALSE;
echo '<p><font color="red">Please enter a valid username!</font></p>';
}
//Check that the passwords are entered and match each other.
if (!empty($_POST['zip'])){
$zip = $_POST['zip'];
}else{
$zip = FALSE;
echo '<p><font color="red">Please enter your zip</font></p>';
}
//Check the if the file moved over.
if (is_uploaded_file($_FILES['image']['tmp_name'])){
if(move_uploaded_file($_FILES['image']['tmp_name'],
"../{$_FILES['image']['name']}")) {//Move the file over.
//echo '<p> The file has been uploaded!</p>';
} else {//Could not move the file over.
echo '<p><font color="red"> The file could not be moved.</font></p>';
$i = '';
}
$i = $_FILES['image']['name'];
}else{
$i = '';
echo '<p><font color="red">Please try again!</font></p>';
}
if ($un && $pw && $fn && $ln && $em && $city && $state && $zip && $i) { //If everything is ok
header("Location: show.php");
exit();
}