Re: user authentication problem
| From: | Jon Rosenberg | Date: | Fri, 17 Nov 2000 12:29:28 +0000 |
| Subject: | Re: user authentication problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25894@lists.php.net to get a copy of this message | ||
You're leaving out evaluating the query
try something like this:
$result = mysql_query( "SELECT * FROM dialup WHERE userid =
'".$blah."'" );
$num_rows_returned = mysql_num_rows( $result );
if ( $num_rows_returned > 0 )
{
print "success!";
exit;
}
else{}
----- Original Message -----
From: "Andres Montiel" <kyutums@mypad.com>
To: "PHP" <php-general@lists.php.net>
Sent: Friday, November 17, 2000 5:32 AM
Subject: [PHP] user authentication problem
> 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.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>