james13009 Posted June 12, 2008 Share Posted June 12, 2008 Im doing a website for a friend and i need to password protect one page of it. It doesn't need any fancy login, and there will be only ever one user name and password. (which may need changing but not very often). Where can i find the a simple basic script like this. Not sure where to start. Many thanks Link to comment https://forums.phpfreaks.com/topic/109973-need-to-password-protect-one-page-where-to-start/ Share on other sites More sharing options...
rondog Posted June 12, 2008 Share Posted June 12, 2008 look into an .htaccess file and just put that page in its own folder..you would basically protect the folder Link to comment https://forums.phpfreaks.com/topic/109973-need-to-password-protect-one-page-where-to-start/#findComment-564313 Share on other sites More sharing options...
jonsjava Posted June 12, 2008 Share Posted June 12, 2008 <?php $username = "theking"; $password = "cheese"; if (isset($_POST['username']) &&($_POST['username'] == $username && $_POST['password'] == $password)){ //put your sensitive stuff here } else{ ?> <center><form method="POST" action="?"> <table border="0"> <tr> <td>Username:</td> <td><input type="text" name="username"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password"></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Login"></td> </tr> </table> </form> </center> <?php } Link to comment https://forums.phpfreaks.com/topic/109973-need-to-password-protect-one-page-where-to-start/#findComment-564317 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.