A
Anonymous
Guest
Hi guys,
I created a login table in mysql, only two colums: user_name and user_pwd.
Two problems:
1. if table only has one row: user has to type twice correct user_name and user_pwd, then can login.
2. if table has one more row, user cant login, even with correct user_name and user_pwd.
my php coding must has problems, please help me to find out, thanx
<?php
$result = mysql_query("select * from user_access")
or die(mysql_error());
while ($row = mysql_fetch_array($result) AND TRUE)
{
if (strcmp($_POST['user_name'], $row["user_name" ])!= 0 AND $_POST['user_pwd']!= $row["user_pwd"] )
{
print ("<font color='red' size='3'><center><strong>Password or Username are not correct!Please try again</strong></center></font>");
return FALSE;
//exit;
}
}
print ("<font color='green' size='3'><center><strong>Welcome to visit our products!</strong></center></font>");
?>
I created a login table in mysql, only two colums: user_name and user_pwd.
Two problems:
1. if table only has one row: user has to type twice correct user_name and user_pwd, then can login.
2. if table has one more row, user cant login, even with correct user_name and user_pwd.
my php coding must has problems, please help me to find out, thanx
<?php
$result = mysql_query("select * from user_access")
or die(mysql_error());
while ($row = mysql_fetch_array($result) AND TRUE)
{
if (strcmp($_POST['user_name'], $row["user_name" ])!= 0 AND $_POST['user_pwd']!= $row["user_pwd"] )
{
print ("<font color='red' size='3'><center><strong>Password or Username are not correct!Please try again</strong></center></font>");
return FALSE;
//exit;
}
}
print ("<font color='green' size='3'><center><strong>Welcome to visit our products!</strong></center></font>");
?>