...

View Full Version : Password Protection



ttttt
09-01-2006, 10:25 PM
Hi,
I have an area of my site that I would like to password protect. I DO NOT want to use MySQL, but I would like to use flatfiles (preferably) or an xml file. However, the login does need to be a form, the username and password editable and the protection secure.
I know I have very specific requirements, but could someone please help?
Thanks,

googleit
09-01-2006, 10:28 PM
search on google there are loads of free ones :)

Lee Stevens
09-02-2006, 12:43 AM
Not sure if you wanted one at the top of the page, well here's one!



<?PHP
$username = "test";
$password = "test";

function authenticate() {
Header( "WWW-authenticate: basic realm=\"Protected\"");
Header( "HTTP/1.0 401 Unauthorized");
echo "You must enter a valid login ID and password!";
exit;
}

function CheckPwd($user,$pass) {
global $username,$password;
return ($user != $username || $pass != $password) ? false : true;
}

if(!isset($PHP_AUTH_USER)) {
authenticate();
}
elseif(!CheckPwd($PHP_AUTH_USER,$PHP_AUTH_PW)) {
authenticate();
}
?>

ttttt
09-03-2006, 05:49 PM
Thanks, but I have already searched google and don't want a premade script. Also, the login has to be changable and I don't think that storing it in a variable imbedded into a file is the best way.
Can anyone help?
Thanks,

Fumigator
09-03-2006, 06:12 PM
What kind of help are you looking for? You know if one of us were to write the code to make it work, that would be a pre-made script and you wouldn't be happy with that... so, just what is it you want us to do?

lansing
09-03-2006, 07:37 PM
The best way is to look at the pre-made scripts & then just customize it yourself. This way nobody knows what the script looks like.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum