Forum Moderators: coopster
right now im getting a:
Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\RMES Website\php\register.php on line 302
I don't really care for the email validation as this will be solely on a localhost, however I don't know enough to remove it from the template I have been working off of.
<?php
// let's initialize vars to be printed to page in the HTML section so our script does not return errors
// they must be initialized in some server environments
$errorMsg = "";
$firstname = "";
$lastname = "";
$country = "";
$province = "";
$city = "";
$postal_code = "";
$email1 = "";
$email2 = "";
$acp_reg = "";
$rank_medical = "";
$rank_fire = "";
$nok_firstname = "";
$nok_lastname = "";
$nok_country = "";
$nok_province = "";
$nok_city = "";
$nok_postal_code = "";
$nok_phone = "";
$pass1 = "";
$pass2 = "";// This code runs only if the form submit button is pressed
if (isset ($_POST['firstname'])){/* Example of cleaning variables in a loop
$vars = "";
foreach ($_POST as $key => $value) {
$value = stripslashes($value);
$vars .= "$key = $value<br />";
}
print "$vars";
exit();
*/
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$country = $_POST['country'];
$province = $_POST['province'];
$city = $_POST['city'];
$postal_code = $_POST['postal_code'];
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$acp_reg = $_POST['acp_reg'];
$rank_medical = $_POST['rank_medical'];
$rank_fire = $_POST['rank_fire'];
$nok_firstname = $_POST['nok_firstname'];
$nok_lastname = $_POST['nok_lastname'];
$nok_country = $_POST['nok_country'];
$nok_province = $_POST['nok_province'];
$nok_city = $_POST['nok_city'];
$nok_postal_code = $_POST['nok_postal_code'];
$nok_phone= $_POST['nok_phone'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$humancheck = $_POST['humancheck'];$firstname = stripslashes($firstname);
$lastname = stripslashes($lastname);
$country = stripslashes($country);
$province = stripslashes($province);
$city = stripslashes($city);
$postal_code = stripslashes($postal_code);
$email1 = stripslashes($email1);
$email2 = stripslashes($email2);
$acp_reg = stripslashes($acp_reg);
$rank_medical = stripslashes($rank_medical);
$rank_fire = stripslashes($rank_fire);
$nok_firstname = stripslashes($nok_firstname);
$nok_lastname = stripslashes($nok_lastname);
$nok_country = stripslashes($nok_country);
$nok_province = stripslashes($nok_province);
$nok_city = stripslashes($nok_city);
$nok_postal_code = stripslashes($nok_postal_code);
$nok_phone = stripslashes($nok_phone);
$pass1 = stripslashes($pass1);
$pass1 = stripslashes($pass1);
$firstname = strip_tags($firstname);
$lastname = strip_tags($lastname);
$country = strip_tags($country);
$province = strip_tags($province);
$city = strip_tags($city);
$postal_code = strip_tags($postal_code);
$email1 = strip_tags($email1);
$email2 = strip_tags($email2);
$acp_reg = strip_tags($acp_reg);
$rank_medical = strip_tags($rank_medical);
$rank_fire = strip_tags($rank_fire);
$nok_firstname = strip_tags($nok_firstname);
$nok_lastname = strip_tags($nok_lastname);
$nok_country = strip_tags($nok_country);
$nok_province = strip_tags($nok_province);
$nok_city = strip_tags($nok_city);
$nok_postal_code = strip_tags($nok_postal_code);
$nok_phone = strip_tags($nok_phone);
$pass1 = strip_tags($pass1);
$pass1 = strip_tags($pass1);
// Connect to database
include_once "scripts/connect_to_mysql.php";
$emailCHecker = mysql_real_escape_string($email1);
$emailCHecker = eregi_replace("`", "", $emailCHecker);
// Database duplicate e-mail check setup for use below in the error handling if else conditionals
$sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
$email_check = mysql_num_rows($sql_email_check);// Error handling for missing data
if ((!$firstname) ¦¦ (!$lastname) ¦¦ (!$country) ¦¦ (!$province) ¦¦ (!$city) ¦¦ (!$postal_code) ¦¦ (!$email1) ¦¦ (!$email2) ¦¦ (!$acp_reg) ¦¦ (!$rank_medical) ¦¦ (!$rank_fire) ¦¦ (!$nok_firstname) ¦¦ (!$nok_lastname) ¦¦ (!$nok_country) ¦¦ (!$nok_province) ¦¦ (!$nok_city) ¦¦ (!$nok_postal_code) ¦¦ (!$nok_phone) ¦¦ (!$pass1) ¦¦ (!$pass2)) {$errorMsg = 'ERROR: You did not submit the following required information:<br /><br />';
if(!$firstname){
$errorMsg .= ' * First Name<br />';
}
if(!$lastname){
$errorMsg .= ' * Last Name<br />';
}
if(!$country){
$errorMsg .= ' * Country<br />';
}
if(!$province){
$errorMsg .= ' * Provice<br />';
}
if(!$city){
$errorMsg .= ' * City<br />';
}
if(!$postal_code){
$errorMsg .= ' * Postal Code<br />';
}
if(!$email1){
$errorMsg .= ' * Email Address<br />';
}
if(!$email2){
$errorMsg .= ' * Confirm Email Address<br />';
}
if(!$acp_reg){
$errorMsg .= ' * ACP Registration<br />';
}
if(!$rank_medical){
$errorMsg .= ' * Medical Rank<br />';
}
if(!$rank_fire){
$errorMsg .= ' * Fire Rank<br />';
}
if(!$nok_firstname){
$errorMsg .= ' * NOK First Name<br />';
}
if(!$nok_lastname){
$errorMsg .= ' * NOK Last Name<br />';
}
if(!$nok_country){
$errorMsg .= ' * NOK Country<br />';
}
if(!$nok_province){
$errorMsg .= ' * NOK Provice<br />';
}
if(!$nok_city){
$errorMsg .= ' * NOK City<br />';
}
if(!$nok_postal_code){
$errorMsg .= ' * NOK Postal Code<br />';
}
if(!$nok_phone){
$errorMsg .= ' * NOK Phone<br />';
}
if(!$pass1){
$errorMsg .= ' * Login Password<br />';
}
if(!$pass2){
$errorMsg .= ' * Confirm Login Password<br />';
}} else if ($email1 != $email2) {
$errorMsg = 'ERROR: Your Email fields below do not match<br />';
} else if ($pass1 != $pass2) {
$errorMsg = 'ERROR: Your Password fields below do not match<br />';
} else if ($humancheck != "") {
$errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human<br />';
} else if ($email_check > 0){
$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our database. Please use another.<br />";
} else { // Error handling is ended, process the data and add member to database
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////$firstname = mysql_real_escape_string($firstname);
$lastname = mysql_real_escape_string($lastname);
$country = mysql_real_escape_string($country);
$province = mysql_real_escape_string($province);
$city = mysql_real_escape_string($city);
$postal_code = mysql_real_escape_string($postal_code);
$email1 = mysql_real_escape_string($email1);
$acp_reg = mysql_real_escape_string($acp_reg);
$rank_medical = mysql_real_escape_string($rank_medical);
$rank_fire = mysql_real_escape_string($rank_fire);
$nok_firstname = mysql_real_escape_string($nok_firstname);
$nok_lastname = mysql_real_escape_string($nok_lastname);
$nok_country = mysql_real_escape_string($nok_country);
$nok_province = mysql_real_escape_string($nok_province);
$nok_city = mysql_real_escape_string($nok_city);
$nok_postal_code = mysql_real_escape_string($nok_postal_code);
$nok_phone = mysql_real_escape_string($nok_phone);
$pass1 = mysql_real_escape_string($pass1);
$firstname = eregi_replace("`", "", $firstname);
$lastname = eregi_replace("`", "", $lastname);
$country = eregi_replace("`", "", $country);
$province = eregi_replace("`", "", $province);
$city = eregi_replace("`", "", $city);
$postal_code = eregi_replace("`", "", $postal_code);
$email1 = eregi_replace("`", "", $email1);
$acp_reg = eregi_replace("`", "", $acp_reg);
$rank_medical = eregi_replace("`", "", $rank_medical);
$rank_fire = eregi_replace("`", "", $rank_fire);
$nok_firstname = eregi_replace("`", "", $nok_firstname);
$nok_lastname = eregi_replace("`", "", $nok_lastname);
$nok_country = eregi_replace("`", "", $nok_country);
$nok_province = eregi_replace("`", "", $nok_province);
$nok_city = eregi_replace("`", "", $nok_city);
$nok_postal_code = eregi_replace("`", "", $nok_postal_code);
$nok_phone = eregi_replace("`", "", $nok_phone);
$pass1 = eregi_replace("`", "", $pass1);
// Add MD5 Hash to the password variable
$db_password = md5($pass1);// Add user info into the database table for the main site table
$sqlstr ="INSERT INTO myMembers (firstname, lastname, country, province, city, postal_code, email, acp_reg, rank_medical, rank_fire, nok_firstname, nok_lastname, nok_country, nok_province, nok_city, nok_postal_code, nok_phone, password, sign_up_date)
VALUES ('$firstname', '$lastname', '$country', '$province', '$city', '$postal_code', '$email1', '$acp_reg', '$rank_medical', '$rank_fire', '$nok_firstname', '$nok_lastname', '$nok_country', '$nok_province', '$nok_city', '$nok_postal_code', '$nok_phone', '$db_password', now()";
echo $sql;$sql = mysql_query($sqlstr);
$id = mysql_insert_id();
// Create directory(folder) to hold each user's files(pics, MP3s, etc.)
mkdir("http://localhost/RMES%20Website/php/members/$id", 0755);//! Email User the activation link !
$to = "$email1";
$from = "admin@yourdomain.com";
$subject = "Complete yourdomain registration";
//Begin HTML Email Message
$message = "Hi $firstname,Complete this step to activate your login identity at yourdomain.
Click the line below to activate when ready.
http://localhost/activation.php?id=$id&sequence=$db_password
If the URL above is not an active link, please copy and paste it into your browser address barLogin after successful activation using your:
E-mail Address: $email1
Password: $pass1See you on the site!
you@yourdomain.com";
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";mail($to, $subject, $message, $headers);
$msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $firstname, one last step to verify your email identity:</h4><br />
In a moment you will be sent an Activation link to your email address.<br /><br />
<br />
<strong><font color=\"#990000\">VERY IMPORTANT:</font></strong>
If you check your email with your host providers default email application, there may be issues with seeing the email contents. If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br />
";include_once 'msgToUser.php';
exit();
} // Close else after duplication checks
} else { // if the form is not posted with variables, place default empty variables
$errorMsg = "Fields marked with an [ * ] are required";
$firstname = "";
$lastname = "";
$country = "";
$province = "";
$city = "";
$postal_code = "";
$email1 = "";
$email2 = "";
$acp_reg = "";
$rank_medical
$rank_fire = "";
$nok_firstname = "";
$nok_lastname = "";
$nok_country = "";
$nok_province = "";
$nok_city = "";
$nok_postal_code = "";
$nok_phone = "";
$pass1 = "";
$pass2 = "";
}?>
[edited by: coopster at 3:47 am (utc) on Dec. 17, 2009]
[edit reason] removed specifics [/edit]