Jump to content

Whats wrong with this?


Brenton

Recommended Posts

<?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?

Link to comment
https://forums.phpfreaks.com/topic/42200-whats-wrong-with-this/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/42200-whats-wrong-with-this/#findComment-204720
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.