View Full Version : Password Protected Areas


Eilzy
05-27-2003, 08:11 PM
Ok, I've searched and read a few posts, and discovered that JavaScript isn't particularly effective for stuff I really want to be secure. I'm not too bothered about it being overly secure, it isn't really secret stuff I need it for, it's just to keep some people happy.

So, what JavaScripts are best to use, and how do I use them? I basically need one that users have to log in to see certain pages. It's a website for a club, so only the members can see certain areas.

Any other ways to this would also be appreciated - my server can use PHP, SSI and CGI.

Thanks in advance,

Eilzy x

Spirit892
05-27-2003, 08:47 PM
http://lissaexplains.com/forum/search.php?s=&action=showresults&searchid=68735&sortby=lastpost&sortorder=descending

designhazard
06-03-2003, 11:52 AM
name this file password.php and here's the code:

<?
// checks if you have entered a username and a password
if (!$PHP_AUTH_USER || !$PHP_AUTH_PW)
{
// if empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="Admin"');
header('HTTP/1.0 401 Unauthorized');
echo "Authorization Required.";
exit;
}
else
{
// check if the username and password are correct
if (($PHP_AUTH_USER == "YOUR USERNAME HERE") && ($PHP_AUTH_PW == "YOUR PASSWORD HERE"))
{
// dispay happy message and admin stuff
echo "Yay! You entered the correct password! In you go...";
}
else
{
// display angry message for invalid user
echo "Sorry, but you had entered a wrong password! Please try again";
}
}
?>