Why My code is not working

[php]if(isset($_POST[‘login’]))
{
// Checking whether the Login form has been submitted[/color]

$err = array();

// Will hold our errors[/color]

if(!$_POST['username'] || !$_POST['password'])
	$err[] = 'All the fields must be filled in!';

if(!count($err))
{
	$_POST['username'] = mysql_real_escape_string($_POST['username']);
	$_POST['password'] = mysql_real_escape_string($_POST['password']);

// Escaping all input data[/color]

	$row = mysql_fetch_assoc(mysql_query("SELECT id,usr FROM tz_members WHERE usr='{$_POST['username']}' AND pass='".sha1($_POST['password'])."'"));

	if($row['usr'])
	{
		header("Location:memberpage.php");
	}
	else $err[]='Wrong username and/or password!';
}

if($err){
	$message=implode("<br/>",$err);
}

}
?>[/php]

this is my code for login. code have some thing wrong since showing nothing not any message.Also not redirecting the page. plz help me where i m going wrong in my Code. Thanks in Advance

you ave to either echo or print your message

[php]
if($err){
$message=implode("
",$err);
echo $message;
}
[/php]

i will look little later on your other problem have to go to work

Your password in your mysql query is this correct ?

[php]usr=’{$_POST[‘username’]}’[/php]
Maybe it should be without the curly braces unless you add these to your paasword but I doubt it as it unless in pain text.
[php]usr=’$_POST[‘username’]’[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service