PHP auth user script

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Kent.
Guest





PostPosted: Sat Jan 25, 2003 6:07 am    Post subject: PHP auth user script Reply with quote

This is a nice php script for those of you that are having trouble setting up your server settings on user and group authentications.....

Its pretty simple cut and paste, alter the refresh meta tag to where you want the user sent to... and alter the username and password section where it says 'change' put your new login info there. ;) enjoy the script. Please remember though it does not block people from bookmarking the page they are sent to 'YET'....Im working on a solution.

<?php
// File Name: auth.php // Check to see if $PHP_AUTH_USER already contains info
if (!isset($PHP_AUTH_USER)) {
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="Secured Login"');
header('HTTP/1.0 401 Unauthorized');
echo 'Bad Authorization Proper username & password are Required.'; exit;
} else if (isset($PHP_AUTH_USER)) {
if (($PHP_AUTH_USER != "change") || ($PHP_AUTH_PW != "change")) {
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.'; exit;
}
else
{
echo " <P><META http-equiv='refresh' content='1;URL=http://your.com/page u want to protect'>
</p> ";
}
}
?>
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group