Hello Admin,
The following example will help you
HTTP Authentication example
<?php
if(!isset($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\n";
exit;
} else {
echo "<p>Hello $PHP_AUTH_USER.</p>";
echo "<p>You entered $PHP_AUTH_PW as your password.</p>";
}
?>
888888888888888888888888888888888888888888888888888888888888
HTTP Authentication example forcing a new name/password
<?php
function authenticate() {
header( "WWW-Authenticate: Basic realm=\"Test Authentication System\"");
header( "HTTP/1.0 401 Unauthorized");
echo "You must enter a valid login ID and password to access this
resource\n";
exit;
}
if(!isset($PHP_AUTH_USER) || ($SeenBefore == 1 && !strcmp($OldAuth,
$PHP_AUTH_USER)) ) {
authenticate();
}
else {
echo "</p>Welcome: $PHP_AUTH_USER<br>";
echo "Old: $OldAuth";
echo "<form action=\"$PHP_SELF\" METHOD=POST>\n";
echo "<input type=\"hidden\" name=\"SeenBefore\" value=\"1\">\n";
echo "<input type=\"hidden\" name=\"OldAuth\"
value=\"$PHP_AUTH_USER\">\n";
echo "<input type=\"submit\" value=\"Re Authenticate\">\n";
echo "</form></p>\n";
}
?>
Thanks,
Senthilvellan
----- Original Message -----
From: admin <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 14, 2001 11:52 PM
Subject: [PHP] Web page authentications
> I am new to PHP and am confused on HTTP authentications. I have read that
> section in the manual and still have questions. Where does PHP look to see
> if the user is valid or if the passward matches the user. How do you use
> PHP to set up user registration so users can input their information for
> authentication. Can anyone point me in the right direction to read more on
> this and help clear my confusion.
> Pat
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]