Re: password protect WRM2
| From: | James, Yz | Date: | Sun, 07 Jan 2001 20:49:37 +0000 |
| Subject: | Re: password protect WRM2 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-33116@lists.php.net to get a copy of this message | ||
You should consider using usernames and passwords stored in a MySQL table.
What you're doing there would be better with .htaccess and .htpasswd files.
Have a look at this page: http://www.zend.com/zend/tut/authentication.php
James.
>
> I am currently using the following code to password protect a file but it
> uses only one login/pass. How would I change this code to accept multiple
> logins by checking fields login/pass from a mysql db?
>
> Thanks,
> David Smith
>
> <?php
>
> if (!isset($PHP_AUTH_USER))
>
> Header("WWW-Authenticate: Basic realm=\"Combat Flight Center MySQL Admin
> Area\"");
> Header("HTTP/1.0 401 Unauthorized");
> $REMOTE_USER = "combatfs";
> $REMOTE_PASSWORD = "******";
> $PHP_AUTH_USER = "combatfs";
> $PHP_AUTH_PW = "******";
> print "You hit cancel! if it was an accident please <a
> href=\"$PHP_SELF\">click here</a> to try again.";
> exit;
> } else if ((!$PHP_AUTH_USER == "user") && ($PHP_AUTH_PW == "pass"))
>
> print "You are unauthorized";
> }
>
> ?>
>
>
> --
> 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
>