dean7 Posted August 25, 2009 Share Posted August 25, 2009 Hi, ive started coding a new login and register for my website but on the register scrip i have a unexpected $end witch i dont know why. <?php session_start(); include('database.php'); // start register code. -- Line 4 if (isset($_SESSION['username'])){ header("Location: index2.php"); exit(); } // Define post fields into simple variables witch get inserted in to the database -- Line 11 $reg_username = $_POST['reg_username']; $reg_password = $_POST['reg_password']; $email = $_POST['email']; $email1 = $_POST['email1']; $reg_username=trim($reg_username); $reg_password=trim($reg_password); // Getting the data and time the day the user registered -- Line 19 $today = gmdate('Y-m-d h:i:s'); // Making the Varibales stronger -- Line 21 $reg_username = stripslashes($reg_username); $email = stripslashes($email); $quote = stripslashes($quote); $reg_username = strip_tags($reg_username); $email = strip_tags($email); // Making sure no data is the same. If so echo a error -- Line 27 if((!$reg_username) || (!$email) || (!$reg_password)){ $message="Please Fill In All Fields"; }else{ if ($email != $email1){ $message="Emails Dont Match, Please Try Agian"; }elseif ($email == $email1){ // Username only allowed to contain latters -- Line 34 if (ereg('[^A-Za-z0-9]', $reg_username)) { $message="Your Username Can Only Contain Letters."; }elseif (!ereg('[^A-Za-z0-9]', $reg_username)) { // Make sure the username isnt to long or to short -- Line 37 if (strlen($reg_username) <= 3 || strlen($reg_username) >= 40){ $message= "Username Too Big Or Too Small."; }elseif (strlen($reg_username) > 3 || strlen($reg_username) < 40){ // Check email -- Line 41 $sql_email_check = mysql_query("SELECT email FROM users WHERE email='$email' AND status='Alive'"); $sql_username_check = mysql_query("SELECT username FROM users WHERE username='$reg_username'"); // Check email doesnt exict twice on different users -- Line 46 $email_check = mysql_num_rows($sql_email_check); $username_check = mysql_num_rows($sql_username_check); // If = anything but 0 email allready in database // Line 49 if(($email_check > 0) || ($username_check > 0)){ echo "Im sorry but there has been an error please read on..<br />"; if($email_check > 0){ $message= "Your email address has already been used by another gangster!"; unset($email); } if($username_check > 0){ $message="Your desired username is already in use!"; unset($reg_username); } } // Get ip // Line 64 $ip = $_SERVER['REMOTE_ADDR']; // Get a random password // Line 66 $random_password22=rand(11111,99999999); // Put into the database // Line 70 mysql_query("INSERT INTO `users` ( `id`, `username`, `password`, `online`, `status`, `email`, `l_ip` ) VALUES ( '', '$reg_username', '$reg_password', '0000-00-00 00:00:00', 'Active', '$email', '$ip')"); // Userid insert -- Line 75 $userid = mysql_insert_id(); $message= 'Account created, <a href="index.php">You may now log in.</a> '; // end script -- Line 80 ?> <html> <head> <title>Great-Gaming | Register</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="includes/in.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--> </script> <style type="text/css"> <!-- body { background-image: url(includes/bg.jpg); } .style4 {font-weight: bold} --> </style></head><html> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- ImageReady Slices (a try.psd) --> <table width="402" height="600" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> <!--DWLayoutTable--> <tr> <td width="211" height="98"> </td> <td width="401"> </td> <td width="366"> </td> </tr> <tr> <td height="189"> </td> <td valign="top"><form name="form2" method="post" action=""> <table width="400" height=29 border="1" cellpadding="0" cellspacing="0" class=thinline rules=none> <tr> <td height=29 background="includes/grad.gif"><div align="center"> <p><b>Register</b></p> </div></td> </tr> <tr bgcolor=black> <td height=1 colspan=3></td> </tr> <tr> <td align="center" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td colspan="2"><div align="center"><font color=red> <? echo "$message"; ?> </font></div></td> </tr> <tr> <td width="25%">Username:</td> <td width="75%"><input name="reg_username" type="text" id="reg_username" value="" size="30" maxlength="40"></td> </tr> <tr> <td width="25%">Password:</td> <td width="75%"><input name="reg_password" type="text" id="reg_password value="" size="30" maxlength="40"></td> </tr> <tr> <td>Email address:</td> <td><input name="email" type="text" id="username3" value="" size="30" ></td> </tr> <tr> <td>Confirm email:</td> <td><input name="email1" type="text" id="email" value="" size="30"></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Register"></td> </tr> <tr> <td> </td> <td> </td> </tr> </table></td> </tr> </table> </form></td> <td> </td> </tr> <tr> <td height="14"></td> <td valign="top"><form name="form1" method="post" action=""> <div align="center"><span class="style4"><a href="index.php">Login</a> | <a href="lost.php">Lost password </a></span></div> </form></td> <td></td> </tr> <tr> <td height="487"></td> <td> </td> <td></td> </tr> </table> Line 188 The error code im gettting is Parse error: syntax error, unexpected $end in /home/a4314615/public_html/register.php on line 188 Sorry about the long code but i though ill post it all, because it could help. Please help thanks Quote Link to comment https://forums.phpfreaks.com/topic/171751-unexpected-end/ Share on other sites More sharing options...
Adam Posted August 25, 2009 Share Posted August 25, 2009 On line 37 there's an unclosed brace. Edit: Appears to be one missing on line 41 too. Quote Link to comment https://forums.phpfreaks.com/topic/171751-unexpected-end/#findComment-905621 Share on other sites More sharing options...
obay Posted August 25, 2009 Share Posted August 25, 2009 that error usually happens when there is an unclosed brace Quote Link to comment https://forums.phpfreaks.com/topic/171751-unexpected-end/#findComment-905623 Share on other sites More sharing options...
robert_gsfame Posted August 25, 2009 Share Posted August 25, 2009 YEAH...Check your " } " Quote Link to comment https://forums.phpfreaks.com/topic/171751-unexpected-end/#findComment-905742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.