Commit 8ee80a61 by Van Toan Vu

add auth

parent 0cb0056a
// <?php header( 'Location: /index.html' ) ; ?>
<?php <?php
function require_auth() { function require_auth() {
$AUTH_USER = 'zigexn'; $AUTH_USER = 'zigexn';
...@@ -13,7 +12,16 @@ function require_auth() { ...@@ -13,7 +12,16 @@ function require_auth() {
if ($is_not_authenticated) { if ($is_not_authenticated) {
header('HTTP/1.1 401 Authorization Required'); header('HTTP/1.1 401 Authorization Required');
header('WWW-Authenticate: Basic realm="Access denied"'); header('WWW-Authenticate: Basic realm="Access denied"');
exit; return false;
} else {
return true;
} }
}
if (require_auth()) {
header( 'Location: /index.html' ); header( 'Location: /index.html' );
return false; // serve the requested resource as-is.
} else {
echo "Access denied";
} }
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment