Example #1
0
    }
    //end if
    // //make sure certain fields are only alphabetic.  Log errors if not.
    // $fields = array(
    // 	'First Name'       => 'first_name',
    // 	'Last Name'        => 'last_name'
    // );
    // if( !empty($_POST['first_name']) || !empty($_POST['last_name']) ) {
    // 	foreach( $fields as $field ) {
    // 		if( isset($_POST[$field]) ) {
    // 			if( !ctype_alpha($_POST[$field]) ) {
    // 				$errors[] = "Your name can only contain letters.";
    // 			}
    // 			//end if
    // 		}
    // 		//end if
    // 	}
    // 	//end foreach
    // }
    // //end if
    //make sure user doesn't already exist
    if ($db->user_already_exists($_POST['email'])) {
        $errors[] = "I am sorry, a user with that email address already exists.";
    }
    //if there are no errors - enter information into database, else report errors.
    if (empty($errors)) {
        $db->log_new_user_information();
        header("Location:" . BASE_URL . "success");
    }
}
//end if submit