?? Login problems ??

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

 



Hi,

I have this script that logs people into a website
using cookies.  On my linux web server it works fine
but when I downloaded the Windows version of mysql for
my personal PC to do offline work I get an error with
the identical file.

The error is on line 86 undefined username

But on my linux server I don't get it.  But with the
error I can't test things offline.  

I have included the file that is producing the error.

<?php

$dblink = mysql_pconnect("localhost","usr","pass");
mysql_select_db("mydb");

$headers=0; 

if ( !isset($redirect))
   {
     $redirect = "tip.php";
   }

if (isset($Username) && isset($Password)) {

  $query = "select * from tipping where nickname =
\"$Username\" and password = \"$Password\"";

  if ( !($dbq = mysql_query($query, $dblink))) {
    echo "Unable to query database.  Please Contact <a
href=\"sales@tassiedemononline.org.au\">mailto:sales@tassiedemononline.org.au</a>.\n";
    exit;
  }

  $lim = mysql_num_rows( $dbq );

  if ($lim != 1) {

  $headers=1; 
  echo "<HTML><HEAD><TITLE>Login
Page</TITLE></HEAD><BODY>";
  echo "<B><center><font color=red>Invalid User ID or
Password. Please Try again</B><BR></font></center>";

  }

  if ($lim == 1) {

  $timer = md5(time());
  $sid = $Username . "+" . $timer;
  SetCookie("login",$sid,time()+3600); 
  $query = "update tipping set sid=\"$timer\" where
nickname=\"$Username\"";

  if( !($dbq = mysql_query( $query, $dblink))) {
    echo "Unable to update database.  Please contact
<a
href=\"sales@tassiedemononline.org.au\">mailto:sales@tassiedemononline.org.au</a>.\n";
  exit;
  }

  header("Location: $redirect");
  exit;

}

if (isset($login)) {
  $headers=1;
  $sidarray = explode("+", "$login");
  $query = "select * from tipping where nickname =
\"$sidarray[0]\" and sid = \"$sidarray[1]\"";

  if ( !($dbq = mysql_query($query, $dblink))) {
    echo "Unable to find database.  Please Contact <a
href=\"mailto:sales@tassiedemononline.org.au\";>sales@tassiedemononline.org.au</a>.\n";
    exit;
  }

  if (mysql_num_rows( $dbq ) == 1) {
    echo "<HTML><HEAD><TITLE>Login
Page</TITLE></HEAD><BODY>";
    echo "<center>You are already logged in as
$sidarray[0].<BR>";
    echo "You may logon as another user or simply
begin using our services with your current
session.<BR>";
    echo "Click <A
Href=\"http://www.tassiedemononline.org.au/tiplogin.php\";>Here</A>
to return to our homepage.</center>";
  }
}
if ($headers == 0) {
echo " ";
}
}

echo "<Form Action=\"tiplogin.php\" METHOD=POST>";
echo "<H2>User Name</H2>";
echo "<Input TYPE=\"text\" Name=\"Username\">";
echo "<BR>";
echo "<H2>Password</H2>";
echo "<Input TYPE=\"password\" Name=\"Password\">";
echo "<BR>";
echo "<Input Type=\"submit\" Value=\"Submit\">";
echo "<Input Type=\"hidden\" Name=\"redirect\"
Value=\"tip.php\">";
echo "</FORM>";

?>


Any ideas?  

Thanks!

Jerry

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

  Powered by Linux