Authenticating User ID/Pass in Database problem
| From: | Erik Boles | Date: | Mon, 27 Nov 2000 08:00:03 +0000 |
| Subject: | Authenticating User ID/Pass in Database problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27316@lists.php.net to get a copy of this message | ||
I am sure this question has been asked before, but have searched the digests
and have not found anything.
We have a form that is asking for User ID (userid) and Password (password)
and then passing them to login.php3 (code below). The code _should_ give a
success message and link to those who supply both pieces correctly and an
error message to those who do not. However, the code below is giving the
error message regardless of whether the information being supplied is
correct or not.
Any help on what we have done wrong is greatly appreciated.
======================
<HTML><BODY>
<?php
switch ($position)
{
case "process":
require('logon.inc');
$query = "select userid, password, company, from registration where
userid='$userid' and password='$password'";
$result = mysql_query($query);
$row = @mysql_fetch_array($result
if ($row["userid"] == $userid)
{
if ($row["password"] == $password)
?>
<html><head></head><body bgcolor="#FFFFFF">
<center>
Welcome back to the website, <?PHP print $row["company"];
?>.<br><br>
Please click <a href="registered/registered.html"
target="_top">here</a> to
complete the login process and begin using the site.
</center>
<?php
}
else
{
?>
<html><head></head><body bgcolor="#FFFFFF">
<center>
<B>
Either you do not currently have a membership with us or you
have entered
an invalid Member ID/Password combination.<br><br>
Please click <a href="register/register.htm"
target="_top">here</a> to
join<br><br>-OR-<br><br>Click <a
href="index.htm">here</a>
to try again.
</B>
</center>
<?php
}
}
else
{
?>
<html><head></head><body bgcolor="#FFFFFF">
<center>
<B>
Either you do not currently have a membership with us or you have entered
an invalid Member ID/Password combination.<br><br>
Please click <a href="register/register.htm"
target="_top">here</a> to
join<br><br>-OR-<br><br>Click <a
href="index.htm">here</a> to try again.
</B>
</center>
<?php
}
}
?>
</BODY></HTML>
=======================================
Erik .