dizzleboi1 Posted April 15, 2008 Share Posted April 15, 2008 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '}' in (HIDDEN FOR SECRURITY PURPOSES) on line 154 <php><center> <?php error_reporting(E_ALL); include_once "functions.php"; connect(); if(!isset($_POST['submit'])){ echo "<div align=\"center\"><table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"index.php\">\n"; echo "<tr><td colspan=\"2\" align=\"center\"><font face=\"Microsoft Sans Serif\"><b><font size=\"2\">Register (Forums, Player Centre, Etc)</td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">Armagetron Name:</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">Password:</td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">Confirm Password:</td><td><input type=\"password\" name=\"passconf\"></td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">E-Mail Address :</td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">Full Name:</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">AIM Address:</td><td><input type=\"text\" name=\"aim\"></td></tr>\n"; echo "<tr><td><font face=\"Microsoft Sans Serif\">MSN Address:</td><td><input type=\"text\" name=\"aim\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"class=\"button1\"></td></tr>\n"; echo "</form></table>\n"; } else { $username = protect($_POST['username']); $password = protect($_POST['password']); $confirm = protect($_POST['passconf']); $email = protect($_POST['email']); $name = protect($_POST['name']); $aim = protect($_POST['aim']); $msn = protect($_POST['msn']); $errors = array(); if(!$username){ $errors[] = "Username is not defined!"; } if(!$password){ $errors[] = "Password is not defined!"; } if(!$password){ if(!$confirm){ $errors[] = "Confirmation password is not defined!"; } } if(!$email){ $errors[] = "Email is not defined!"; } if(!$name){ $errors[] = "Name is not defined!"; } if (!$aim){ $errors[] = "AIM Screename is not defined!"; } if (!$msn){ $errors[] = "MSN Screename is not defined!"; } If ($username) { if(!ctype_alnum($username)){ $errors[] = "Username can only contain numbers and letters!"; } } $range = range(1,31); if(!in_array(strlen($username),$range)){ $errors[] = "Username must be between 1 and 32 characters!"; } if($password && $confirm){ if ($password != $confirm){ $errors[] = "Passwords do not match!"; } } if($email){ $checkemail = "/^[a-z0-9+([_\\.-][a-z0-9]+([\.-\[a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i"; if(!preg_match($checkemail, $email)){ $errors[] = "E-mail is not valid, must be [email protected]"; } } if($name){ $range2 = range(1,64); if(!in_array(strlen($name),$range2)){ $errors[] = "Your name must be between 3 to and characters!"; } } if($aim){ $range3 = range(3,16); if(!in_array(strlen($aim),$range3)){ $errors[] = "Your AIM screename must be between 3 and 16 charecters!"; } } if($msn){ $range3 = range(3,16); if(!in_array(strlen($msn),$range4)){ $errors[] = "Your MSN screename must be between 3 and 16 charecters!"; } } if($username){ $sql = "SELECT * FROM `users` WHERE `username`='{$username}'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0) { $errors[] = "The username you supplied is already in use!"; } } if($email){ $sql2 = "SELECT * FROM `users` WHERE `email`='{$email}'"; $res2 = mysql_query($sql2) or die(mysql_error()); if(mysql_num_rows($res2) > 0){ $errors[] = "The email you supplied is already in use of another user!"; } } if($aim){ $sql3 = "SELECT * FROM `users` WHERE `aim`='{$aim}'"; $res3 = mysql_query($sql3) or die(mysql_error()); if(mysql_num_rows($res3) > 0){ $errors[] = "The AIM screename you supplied is already in use of another user!"; } } if($msn){ $sql4 = "SELECT * FROM `users` WHERE `msn`='{$msn'}"; $res4 = mysql_query($sql4) or die(mysql_error()); if(mysql_num_rows($res4) > 0){ $errors[] = "The MSN screename you supplied is already in use of another user!"; } } if(count($errors) > 0){ foreach($errors AS $error){ echo $error . "\n"; } } }else { $sql5 = "INSERT INTO `users` (`username`,`password`,`email`,`name`,`aim`,`msn`) VALUES ('$username','$password','$email','$name','$aim','$msn');"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "You have sucessfully registered!</br> Username:<b>{$username}</b></br> Password:<b>{$password}</b></br> E-mail:<b>{$email}</b></br> AIM Screen Name:<b>{$aim}</b></br> MSN Screen Name:<b>{$msn}</b></br> Name:<b>{$name}</b></br>"; } } ?> </php> line 150-160 }else { $sql5 = "INSERT INTO `users` (`username`,`password`,`email`,`name`,`aim`,`msn`) VALUES ('$username','$password','$email','$name','$aim','$msn');"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "You have sucessfully registered!</br> Username:<b>{$username}</b></br> Password:<b>{$password}</b></br> E-mail:<b>{$email}</b></br> AIM Screen Name:<b>{$aim}</b></br> Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/ Share on other sites More sharing options...
Cep Posted April 15, 2008 Share Posted April 15, 2008 here is your problem $sql4 = "SELECT * FROM `users` WHERE `msn`='{$msn'}"; Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518023 Share on other sites More sharing options...
Cep Posted April 15, 2008 Share Posted April 15, 2008 You also have a problem here, if(count($errors) > 0){ foreach($errors AS $error){ echo $error . "\n"; } } } else { $sql5 = "INSERT INTO `users` Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518037 Share on other sites More sharing options...
dizzleboi1 Posted April 16, 2008 Author Share Posted April 16, 2008 i get that theres a problem there the point of the thread is to get it resolved not pointed out.. Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518186 Share on other sites More sharing options...
dizzleboi1 Posted April 16, 2008 Author Share Posted April 16, 2008 okay i realised i was missing a ' after {$msn} now theres a problem on line 137 Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518191 Share on other sites More sharing options...
benphp Posted April 16, 2008 Share Posted April 16, 2008 $sql4 = "SELECT * FROM `users` WHERE `msn`='{$msn'}"; no curly brackets and no single quotes - if that's what they are $sql4 = "SELECT * FROM users WHERE msn='$msn'"; and $sql5 = "INSERT INTO `users` no single quotes $sql5 = "INSERT INTO users not sure if these ` ` are the same thing as these ' ' Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518194 Share on other sites More sharing options...
Cep Posted April 16, 2008 Share Posted April 16, 2008 i get that theres a problem there the point of the thread is to get it resolved not pointed out.. Sorry for trying to help, next time ill remember not too Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518290 Share on other sites More sharing options...
PhillNeedsHelp Posted April 16, 2008 Share Posted April 16, 2008 }else { $sql5 = "INSERT INTO `users` (`username`,`password`,`email`,`name`,`aim`,`msn`) VALUES ('$username','$password','$email','$name','$aim','$msn');"; I don't think this part is right: ('$username','$password','$email','$name','$aim','$msn');"; Try: ('$username','$password','$email','$name','$aim','$msn')"; Link to comment https://forums.phpfreaks.com/topic/101272-parse-error-syntax-error-unexpected-t_constant_encapsed_string-expecting/#findComment-518293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.