Brenton Posted March 11, 2007 Share Posted March 11, 2007 <?php require ('globals.php'); if ($_GET['act'] == "submit") { // For register_global on PHP settings $username = $_POST['username']; $password = $_POST['password']; // Check for empty fields if (empty($username) || empty($password) ) { die ("Error! Please enter your username and password, they are both required. <br /> <a href='$PHP_SELF?'>Go Back</a>"); } // Authenticate user credentials $qChk = "select username from users where username='$username' and password='$password' and status='Y' "; $rsChk = mysql_query($qChk); $rowCount = mysql_num_rows($rsChk); if ($rowCount !='1') // query did not return 1 row, user is not verified { die ("Error. Your password does not match your username or your account was not yet activated. Please try again."); } // User is now logged in, lets give them a cookie. setcookie ("member",$username,time()+1957240,"/"); setcookie ("ip",$REMOTE_ADDR,time()+1957240,"/"); $member = $username; session_register("member"); // Update Login timer $qUpdate = "update users set login = now() where username='$username' and password='$password' and active='Y' "; $rsUpdate = mysql_query($qUpdate); if ($rsUpdate) { header("Location: welcome.php"); // redirects members to a welcome member page } } else { echo <<<END <form action='$PHP_SELF?act=submit' method='post'> <center><table width='300px'><tr><td align='left'>Username:</td><td align='right'> <input type='text' name='username' maxlength='15'></td></tr> <tr><td align='left'>Password:</td> <td align='right'><input type='password' name='password' maxlength='25'></td></tr></table> <input type=submit value=login name=login> </form></center> END; } ?> Whats wrong with my login script? I get a Parse error: syntax error, unexpected '}' in /home/brenton/public_html/nordaea/login.php on line 37 Why's it happening? How do i fix? Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 11, 2007 Share Posted March 11, 2007 This bottom } is 'orphaned' meaning it either doesn't belong and it's one too many or you had it there to close an if statement that isn't set up right. if ($rsUpdate) { header("Location: welcome.php"); // redirects members to a welcome member page } } Quote Link to comment Share on other sites More sharing options...
akitchin Posted March 11, 2007 Share Posted March 11, 2007 it's true about the braces being "orphaned," but the specific line where you go wrong is: <?php if ($rowCount !='1') // query did not return 1 row, user is not verified { die ("Error. Your password does not match your username or your account was not yet activated. Please try again."); } ?> you're commenting out the opening brace on the row count line. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 11, 2007 Share Posted March 11, 2007 That's what is causing that orphaned } then. Nice spot Quote Link to comment 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.