Guest Posted June 30, 2004 Posted June 30, 2004 (edited) I found this protection script, not as secure as fort knox but works good. my problem was that my host control panel is windows, and when I added password protection to my admin panel, all of the files and directory's in the admin area were changed to modified attributes, this in turn would bring up errors when I would try to view my admin panel. here is the coding I found to protect the admin panel, the area to protect would be the admin/index.php. <html> <head> <title>password protection test</title> </head> <body> <?php // Define your username and password $username = "user"; $password = "password"; if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { ?> <p> <b>Login</b> </p> <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div align="center"> <center> <table border="0" cellpadding="5" cellspacing="0"> <tr> <td><label for="txtUsername">Username</label> </td> <td><input type="text" title="Enter your Username" name="txtUsername" /></td> </tr> <tr> <td><label for="txtpassword">Password</label> </td> <td><input type="password" title="Enter your password" name="txtPassword" /></td> </tr> </table> </center> </div> <p align="center"><input type="submit" name="Submit" value="Login" /></p> </form> <?php } else { ?> <p>This is the protected page. Place your entire content of the page to be protected in this area.</p> <?php } ?> </body> </html> I found this at ThinkHost Edited June 30, 2004 by Blackjack Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.