user authentication problem
| From: | Andres Montiel | Date: | Fri, 17 Nov 2000 10:32:07 +0000 |
| Subject: | user authentication problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25884@lists.php.net to get a copy of this message | ||
I'm trying to make a simple authentication script that would check a
user's userid and password against a database.
The script is the following:
<?php
require('global.inc.php');
if ($submit) {
$result = mysql_query("SELECT * FROM users WHERE userid='$userid' and
password='$password'");
if ($result) {
echo "Statement 1";
}
else {
echo "Second Statement.";
}
}
else {
?>
<form action="<?php echo"$PHP_SELF"; ?>" method="post">
<p>Userid
<input type="text" name="userid">
<p>Password
<input type="password" name="password">
<p>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</form>
<?php
}
?>
The global.inc.php contains the commands to connect to the database. I
get connected to the database but the above script still fails. Any
recommendations?
Thanks for all your comments.