1
0
mirror of https://github.com/php/web-php.git synced 2026-04-27 08:58:12 +02:00
Files
archived-web-php/oreilly99/photoc3.php3
T
1999-08-21 16:11:20 +00:00

25 lines
628 B
PHP

<?require "header.inc"?>
<h1>Adding Authentication</h1>
Add this line:
<?example('<? if($REQUEST_METHOD=="POST") include "auth.inc"; ?>');?>
auth.inc contains:
<?example('<?
function authenticate() {
Header("WWW-authenticate: basic realm=\"Photo Album\"");
Header("HTTP/1.0 401 Unauthorized");?>
In order to proceed you will need a valid username/password.
<?
exit;
}
if(!isset($PHP_AUTH_USER)) {
authenticate();
} else {
if($PHP_AUTH_USER != "rasmus" || $PHP_AUTH_PW != "php") {
authenticate();
}
}
?>');?>
<?php require "footer.inc"?>