Auth
This commit is contained in:
parent
257d3c89a4
commit
213995b0aa
19
.htaccess
19
.htaccess
@ -1,10 +1,19 @@
|
|||||||
# Deny access to .htaccess
|
|
||||||
<Files .htaccess>
|
<Files .htaccess>
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
Deny from all
|
Deny from all
|
||||||
</Files>
|
</Files>
|
||||||
|
|
||||||
AuthUserFile ./.htpasswd
|
<Files users.txt>
|
||||||
AuthType Basic
|
Order allow,deny
|
||||||
AuthName "My restricted Area"
|
Deny from all
|
||||||
Require valid-user
|
</Files>
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
#AuthUserFile ./.htpasswd
|
||||||
|
#AuthType Basic
|
||||||
|
#AuthName "My restricted Area"
|
||||||
|
#Require valid-user
|
@ -39,6 +39,7 @@ $use_password = false;
|
|||||||
$mode_register = false;
|
$mode_register = false;
|
||||||
$mode_digest = false;
|
$mode_digest = false;
|
||||||
|
|
||||||
|
|
||||||
// STYLING (light or dark)
|
// STYLING (light or dark)
|
||||||
$color = "light";
|
$color = "light";
|
||||||
|
|
||||||
@ -68,6 +69,8 @@ if( !$title ) { $title = clean_title(basename(dirname(__FILE__))); }
|
|||||||
|
|
||||||
//
|
//
|
||||||
if ($use_password) {
|
if ($use_password) {
|
||||||
|
// Rely on apache htaccess RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
|
||||||
if ($mode_digest) loginDigest();
|
if ($mode_digest) loginDigest();
|
||||||
else if ($mode_register) register();
|
else if ($mode_register) register();
|
||||||
else login();
|
else login();
|
||||||
@ -535,7 +538,7 @@ function loginDigest() {
|
|||||||
|
|
||||||
// ok, valid username & password
|
// ok, valid username & password
|
||||||
echo 'You are logged in as: ' . $data['username'];
|
echo 'You are logged in as: ' . $data['username'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// function to parse the http auth header
|
// function to parse the http auth header
|
||||||
|
Loading…
x
Reference in New Issue
Block a user