In my web site, I have an area(directory) that is password protected via an .htaccess file. So when I am linking to files inside that directory I get the browser default user/password dialog. I am wondering if there is any way to modify this dialog? I would like to change the copy inside of it, add a button and link to another page. The issue is basically that the client wants to point out a way to get the user and pass for people that don't have it.
Is this possible? What other options do I have with this dilema?
Thanks a lot!
All depends on where you store the user names and passwords and how much security you need.
A good place to start might be with David Powers' Tutorial.
"Building your first dynamic website – Part 1: Setting up your site and database connection"
http://www.adobe.com/devnet/dreamweaver/articles/first_dynamic_site_pt 1.html
Nancy O.
Do you have the use of php? If so below is a simple login that can be styled to suit yourself. Additional usernames/passwords can be added if necessary but once you get beyond a certain amount it's best to store the information in a database. This solution will suit a dozen or so usernames/passwords. The username at the moment is "Pink" and password is "Elephant". You can change those in the php code below, also change the 'Location' url of the protected page to be taken to if the user supplies the correct combination
The form 'action' points to the page where you insert the form. So if you include the form on a page called no_database.php that's where the form sends the form information to be processed (obviously the php must be included at the top of that page as well)
<?php
if (array_key_exists('login', $_POST)) {
$username = $_POST['username'];
$password = $_POST['password'];
if($username == "Pink" && $password == "Elephant") {
header("Location: http://www.bbc.co.uk"); }
else {
$passError = "<h2>Incorrect Username or Password</h2>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="no_database.php" method="post">
<p>Username<br />
<input name="username" type="text" /></p>
<p>Password<br />
<input name="password" type="text" /></p>
<label for="button"></label>
<input type="submit" name="login" id="login" value="Login" />
</form>
<?php
if(isset($passError)) {
echo $passError;
}
?>
</body>
</html>
North America
Europe, Middle East and Africa
Asia Pacific