php - Replace Htaccess popup box with a html form? -
i have password-protected directory on website using htaccess. when type in url folder simple popup box can type in info. fine. want have html/php/mysql form can log in, instead of popup box. there way this? note: directory want protect has hundreds of files.
i know how make form, query database, want replace popup html form.
one possible approach...
say want protect directory "protected".
using .htaccess
, limit access directory putting
options -indexes # block external access deny
in .htaccess
file within "protected" directory.
next, use rewriterule catch url's going "protected" directory in main .htaccess
file. example:
rewriteengine on rewriterule ^protected/(.*) accessprotected.php?url=$1
normally, rewriterule should catch url's going "protected" directory , transmit them accessprotected.php-page.
on accessprotected.php-page, check login-status.
if (isset($_session['loggedin'])) { // or /* here, should check file type being requested , handle properly. */ } else { // put code login form here }
Comments
Post a Comment