|
Posted by Els on 03/09/07 09:07
Rik wrote:
>> But how/where do I preset a username & password?
>> (yes I'm a total noob :-) )
>
> Use one preset username & password in a file:
> <?php
> $username = 'username';
> $password = 'password';
> if (!isset($_SERVER['PHP_AUTH_USER'])) {
> header('WWW-Authenticate: Basic realm="My Realm"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Text to send if user hits Cancel button';
> exit;
> } else {
> if($_SERVER['PHP_AUTH_USER'] != $username)
> echo 'Username incorrect:'.$_SERVER['PHP_AUTH_USER'].',
> expected:'.$username;
> if($_SERVER['PHP_AUTH_PW'] != $password)
> echo 'Username incorrect:'.$_SERVER['PHP_AUTH_PW'].',
> expected:'.$password;
> }
> ?>
>
> Take it from there, add the md5 in later, then try it in Joomla, the try
> to use the database.
Thanks Rik, I've tried that in a local page, and it works. That is, it
lets me in regardless of whether I get the password right or not, the
difference is the error message if I got it wrong. How do I get a new
login prompt if the details are incorrect, and also, how do I "log
out" again? I can't make two attempts in a row, it just keeps whatever
I filled out once as final...
--
Els http://locusmeus.com/
Now playing: David Bowie - Absolute Beginners
Navigation:
[Reply to this message]
|