2013-11-14 13 views

Odpowiedz

1

Tak, jest to możliwe, ale nie powinieneś używać uwierzytelniania htaccess, musisz zaimplementować niestandardowy formularz logowania w HTML-u & PHP.

można zaimplementować coś takiego w PHP & .htaccess

admin/.htaccess:

RewriteCond %{REQUEST_FILENAME} !check_auth.php 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule .* check_auth.php?file=$0 [QSA,L] # pass everything thru php 

admin/check_auth.php:

$file = $_GET['file']; 

if($_SESSION['user_authenticated']) { 
    // please mind you need to add extra security checks here (see comments below) 
    readfile($file); // if it's php include it. you may need to extend this code 
}else{ 
    // bad auth error 
} 

można uzyskać dostęp do plików katalogów tak

check_auth.php?file=filename