Reply to How to set the username/password when using http authentication?

Your name:

Reply:


Posted by Els on 03/07/07 09:51

Hi all,

I'm working on a Joomla installation with various components, and one
of them needs to have one page (with an entry form) password
protected. (Joomla caters for protection of the entire component, but
that's not what I want)

I found this code on php.net:

<?php
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 {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your
password.</p>";
}
?>

And it does indeed work if I use it on the page with the form, in the
sense that a login thingy pops up.
What I don't know though, is how I set the username and password to
check against, so that I can give some people permission to see that
form.

Probably something really simple, but I don't see it...

If possible, I'd like it to check against usernames that are already
in the database, and which have certain rights, but I'm happy already
if I can just set any username/password.

--
Els http://locusmeus.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация