dewdezyn wrote: Thanks! Will this work on multiple pages? If so, how much of the code (and which pieces/where) do I paste into the page codes? I am trying to put a 'mild' protection on three pages of my website. Thanks, Brent DeWitt DeWitt Design 216.534.6397 Yes it works on multiple pages. You would just duplicate the page, rename it something else and link the next page you want protected to it (read below) Below is a page which has been styled up a bit more (see code below) All you do is copy the whole of the code. Insert it into a new Dreamweaver document and save it as passwordProtected.php (remember this will only work if you have php running on your host server i.e., the server that your website is hosted on). Link the first page you want protected to the 'passwordProtected.php' file. You can change the 'username' & 'password' to anything you like. Just look for the line below in the code and change "Pink" & "Elephant" to what you require. if (($username == "Pink") && ($password == "Elephant")) Look for this line below and change 'http://www.bbc.co.uk' to the webpage you want protected. $response = "Youre welcome! <a href='http://www.bbc.co.uk'>Enter Here</a>"; If you want to protect multiple pages just duplicate the 'passwordProtected.php' file, rename it something like 'passwordProtected_2.php', link your next protected page to it and change the url address in the php code. Here is the complete page code: <!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> <?php if (array_key_exists('ewTest' , $_POST)) { $username = trim($_POST['username']); $password = trim($_POST['password']); if (($username == "Pink") && ($password == "Elephant")) { $response = "Youre welcome! <a href='http://www.bbc.co.uk'>Enter Here</a>"; } else { $response = "Sorry, you do not have permission to access this webpage!"; } } ?> <style type="text/css"> #wrapper { width: 250px; padding: 20px; margin: 20px auto; background-color:#CCC; font-family: verdana, arial, helvetica, sans-serif; font-size: 11px; } #wrapper p { margin: 0 0 0 0; padding: 0; text-align: center; } input { width: 250px; } input#submit { width: 100px; margin: 15px 0 0 0; } </style> </head> <body> <div id="wrapper"> <p style="margin-bottom: 10px;">Please enter your Username & Password below. (Case sensitive)</p> <form id="form1" name="form1" method="post" action="passtest.php"> <label>Username</label><br /> <input type="text" name="username" id="username" value=""/><br /> <label>Password</label><br /> <input type="text" name="password" id="password" value=""/><br /> <input type="submit" name="ewTest" id="submit" value="Submit" /> </form> <p style="margin-top: 10px;"> <?php if(isset($response)) echo $response;?> </p> </div> </body> </html>
... View more