Zoroaster Posted August 16, 2009 Share Posted August 16, 2009 Hey, I can't see what I'm doing wrong here... The error message i get is: Parse error: syntax error, unexpected $end in /home/XXXXXXX/public_html/register.php on line 93. line 93 is obviously the bottom. Thanks for any help! <?php include_once "functions.php"; connect(); if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"register.php\">\n"; echo "<tr><td colspan=\"2\" align=\"center\">Registration Form</td></tr>\n"; echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Password</td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td>Confirm</td><td><input type=\"password\" name=\"passconf\"></td></tr>\n"; echo "<tr><td>E-Mail</td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td</tr>\n"; echo "</form></table>\n"; }else { $username = protect($_POST['username']); $password = protect($_POST['password']); $confirm = protect($_POST['passconf']); $email = protect($_POST['email']); $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[] = "E-mail is not defined!"; } if($username){ if(!ctype_alnum($username)){ $errors[] = "Username can only contain letters and numbers!"; } $range = range(1,32); 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($checkmail, $email)){ $errors[] = "E-mail is not valid, must be [email protected]!"; } } if($username){ $sql = "SELECT * FROM 'Login' 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 'Login' WHERE 'email'='{$email}'"; mysql_query($sql1) or die(mysql_error()); if(mysql_num_rows($res2) > 0) { $errors[] = "The e-mail address you supplied is already in use!"; } } if(count($errors) > 0){ foreach($errors AS $error){ echo $error . "<br>\n"; } }else { $sql4 = "INSERT INTO `Login` (`username`,`password`,`email`,`admin`,`time`) VALUES ('".$username."','".md5($password)."','".$email."','0','".time()."')"; $res4 = mysql_query($sql4) or die(mysql_error()); echo "You have successfully registered with the username <b>".$username."</b> and the password of <b>".$password."</b>!"; } } ?> Link to comment https://forums.phpfreaks.com/topic/170563-unexpected-end-please-help/ Share on other sites More sharing options...
Mardoxx Posted August 16, 2009 Share Posted August 16, 2009 check your brackets you're missing a } somewhere scratch that.. add a } to the end Link to comment https://forums.phpfreaks.com/topic/170563-unexpected-end-please-help/#findComment-899663 Share on other sites More sharing options...
Andy-H Posted August 16, 2009 Share Posted August 16, 2009 <?php include_once "functions.php"; connect(); if(!isset($_POST['submit'])){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"register.php\">\n"; echo "<tr><td colspan=\"2\" align=\"center\">Registration Form</td></tr>\n"; echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Password</td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td>Confirm</td><td><input type=\"password\" name=\"passconf\"></td></tr>\n"; echo "<tr><td>E-Mail</td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td</tr>\n"; echo "</form></table>\n"; }else{ $username = protect($_POST['username']); $password = protect($_POST['password']); $confirm = protect($_POST['passconf']); $email = protect($_POST['email']); $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[] = "E-mail is not defined!"; } if($username){ if(!ctype_alnum($username)){ $errors[] = "Username can only contain letters and numbers!"; } $range = range(1,32); 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($checkmail, $email)){ $errors[] = "E-mail is not valid, must be [email protected]!"; } } if($username){ $sql = "SELECT * FROM 'Login' 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 'Login' WHERE 'email'='{$email}'"; mysql_query($sql1) or die(mysql_error()); if(mysql_num_rows($res2) > 0) { $errors[] = "The e-mail address you supplied is already in use!"; } } if(count($errors) > 0){ foreach($errors AS $error){ echo $error . "<br>\n"; } }else { $sql4 = "INSERT INTO `Login` (`username`,`password`,`email`,`admin`,`time`) VALUES ('".$username."','".md5($password)."','".$email."','0','".time()."')"; $res4 = mysql_query($sql4) or die(mysql_error()); echo "You have successfully registered with the username <b>".$username."</b> and the password of <b>".$password."</b>!"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/170563-unexpected-end-please-help/#findComment-899664 Share on other sites More sharing options...
Mardoxx Posted August 16, 2009 Share Posted August 16, 2009 lol Link to comment https://forums.phpfreaks.com/topic/170563-unexpected-end-please-help/#findComment-899667 Share on other sites More sharing options...
Zoroaster Posted August 16, 2009 Author Share Posted August 16, 2009 Thanks! It's a bad code though, jeez... The form doesn't work at all! Every time i hit submit it just gives me another error message or turns blank. Link to comment https://forums.phpfreaks.com/topic/170563-unexpected-end-please-help/#findComment-899671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.