Alright.... I can't figure this out so here it goes....
I get the following error "Parse error: parse error, unexpected $end in C:\Inetpub\latitudeairlines\join2.php on line 146" when a form is submited. Line 146 is ?>.
<?
$dbhost = 'localhost';
$dbusername = 'latitudeairlines';
$dbpasswd = '********';
$database_name = 'latitudeairlines';
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
or die ("Couldn't connect to server.");
$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.");
error_reporting(E_ERROR | E_WARNING);
$first_name = $_POST['first_name'];
$middle_initial = $_POST['middle_initial'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$country = $_POST['country'];
$state = $_POST['state'];
$DOB = $_POST['DOB'];
$member_id = $_POST['member_id'];
$eskycallsign = $_POST['eskycallsign'];
$hub = $_POST['hub'];
$previous_va = $_POST['previous_va'];
$transfer_hours = $_POST['transfer_hours'];
$va_name = $_POST['va_name'];
$va_address = $_POST['va_address'];
$number_hours = $_POST['number_hours'];
$verification_hours = $_POST['verification_hours'];
$comments = $_POST['comments'];
if((!$first_name) || (!$last_name) || (!$email_address) || (!$Country) || (!$state) ||
(!$DOB) || (!$member_id) || (!$eskycallsign) || (!$hub) || (!$previous_va) || (!$transfer_hours)){
echo 'You did not submit the following required information! <br />';
if(!$first_name){
echo "First Name is a required field. Please enter it below.<br />";
}
if(!$last_name){
echo "Last Name is a required field. Please enter it below. <br />";
}
if(!$email_address){
echo "Email Address is a required field. Please enter it below. <br />";
}
if(!$country){
echo "You country is required. Please enter it below. <br />";
}
if(!$state){
echo "You state is required. If you do not live in a state please enter the providence which you live in. <br />";
}
if(!$DOB){
echo "Your date of birth is required to join. Please enter it below. <br />";
}
if(!$member_id){
echo "You must enter a member id. Please enter one below. <br />";
}
if(!$eskycallsign){
echo "You must be a member of eskyworld to join us. Please click <a herf=http://www.eskyworld.com target=_blank>here</a> to sign up.<br />";
}
if(!$hub){
echo "You must sign up for a hub. Please select one below. <br />";
}
if(!$previous_va){
echo "You must tell us if you have been in a previous VA. Please select it below. <br />";
}
if(!$transfer_hours){
echo "You must tell us if you have any hours to transfer. Please select it below. <br />";
}
include'join_form.php';
exit();
$sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'");
$sql_username_check = mysql_query("SELECT member_id FROM users WHERE member_id='$member_id'");
$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);
if(($email_check > 0) || ($username_check > 0)){
echo "Please fix the following errors: <br />";
if($email_check > 0){
echo "<strong>Your email address has already been used by another member in our database. Please submit a different Email address.<br />";
unset($email_address);
}
if($username_check > 0){
echo "The member id you have selected has already been used by another member in our database. Please choose a different id.<br />";
unset($username);
}
include 'join_form.php';
exit();
}
function makeRandomPassword() {
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
$db_password = md5($random_password);
$info2 = htmlspecialchars($info);
$sql = mysql_query("INSERT INTO users (first_name, middle_initial, last_name, email_address, country, state, DOB, member_id,
eskycallsign, hub, previous_va, transfer_hours, va_name, va_address, number_hours, verification_hours, comments, password, signup_date)
VALUES('$first_name', '$middle_initial', '$last_name', '$email_address', '$country', '$state', $DOB', $'member_id',
'$eskycallsign', '$hub', '$previous_va', '$transfer_hours', '$va_name', '$va_address', '$number_hours', '$verification_hours'
'$comments', '$db_password', now())") or die (mysql_error());
if(!$sql){
echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
$userid = mysql_insert_id();
// Let's mail the user!
$subject = "Welcome to Latitude Airlines!";
$message = "Dear $first_name $last_name,
Thank you for registering at our website, Latitude Airlines!
You are two steps away from logging in and accessing our members area.
To activate your membership, please click here: [url]http://latitudeairlines.sytes.net/membership/activate.php?id=[/url]$userid&code=$db_password
Once you activate your memebership, you will be able to login with the following information:
Username: $username
Password: $random_password
Thank You,
Latitude Airlines
This is an automated response, please do not reply!";
mail($email_address, $subject, $message, "From: Latitude Airlines\nX-Mailer: PHP/" . phpversion());
echo 'Your membership information has been mailed to your email address! Please check it and follow the directions!';
}
?>