I'm trying to bypass the .htaccess default username and password form with a customised form of my own.
I still want all passwords to be authenticated as .htpasswd
file does.
My protected directory is members folder. I'm new to PHP so still trying to get my head around it.
I have checked some similar posts on this site and can't seem to get things working:
Replace Htaccess popup box with a html form?
How can I style a .htaccess password protection promp?
HTML:
<form action="<?=$PHP_SELF?>" method="post">
<div class="title">
<h2 class="section-title">Members Only Login</h2>
</div>
<div class="card_container">
<label for="user"><strong>Username</strong></label>
<input type="text" placeholder="Enter Username" name="user" required="">
<label for="pass"><strong>Password</strong></label>
<input type="password" placeholder="Enter Password" name="pass" required="">
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="card_container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="pass"><a href="https://ajayswebdesign.com.au/dromanavalleyprobus/index.html#info4-38 ">Forgot password?</a></span>
</div>
</form>
PHP:
<?php
if (isset($_POST['done']))
{
$url = "ajayswebdesign.com.au/dromanaprobusclub/members/";
$site = "https://".$_)POST['user'].":".$_POST['pass']."@".$url;
header("Location: $site:);
}
?>