Need Help in the below script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux