Need Help in the below script
| From: | nagendra prasad | Date: | Fri, 04 Sep 2009 09:07:03 +0000 |
| Subject: | Need Help in the below script | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-46467@lists.php.net to get a copy of this message | ||
Hi all,
I am working on my project. I have to create a user regestration page and a
login page. I am done with registration page but when I tried to code the
login page its not working. Below is the code. Please take a look at script
and let me know where am I going wrong.
<?php
$username=$_POST['username'];
$password=$_POST['password'];
if($username&&$password)
{
$connect= mysql_connect("localhost","root","") or
die("couldn't connect");
mysql_select_db("phplogin") or die("no db in the list");
$query = mysql_query("SELECT * FROM users WHEER username='$username'");
$numrows = mysql_num_rows($query);
if ($numrows!=0)
{
echo "user dosen't exist";
while ($row = mysql_fetch_assoc($query))
{
$dbusername = $row['username'];
$dbpassword = $row['password'];
}
if ($username==$dbusername && $password==$dbpassword)
{
echo "you are in";
}
else
echo "incorrent username and password";
else
die("user dosent exitst");
}
else
die("please enter a username and a password");
}
?>
--
Guru Prasad
Ubuntu Voice GTK+ Forum