Need help with the code

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

 



Hi All,

I need some help with the below code. I have this login code with me and its
working fine with my *localhost 'WAMP' *server. But when I tried to run the
same script on my web host server its not working. Every time its giving me
the same message "*please enter a username and a password*" which is a
condition within the script.


<?php
session_start();

$username = $_POST['username'];
$password = $_POST['password'];

 if ($username&&$password)

 {
$connect = mysql_connect("localhost", "tutor_root", "admin") or
die("couldn't connect");
mysql_select_db("tutor_register") or die("couldn't find db");


$query = mysql_query("SELECT * FROM register WHERE username ='$username'");
$numrows = mysql_num_rows($query);
if ($numrows!=1)

{
//code to login

while ($row =mysql_fetch_assoc($query))
{
      $dbusername = $row['username'];
      $dbpassword=  $row['password'];

}
 //check to see if they match

 if ($username==$dbusername&&$password==$dbpassword)
 {
echo "you are in <a href='member.php'>click</a> here to enter the members
page";


$_SESSION['username']=$username;

 }
 else

 echo "incorrect password";
}
else

    die("That user dosen't exist");


}
  else
      die("pelase 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