Posted By

kbrown on 08/19/11


Tagged

login


Versions (?)

PHP - Basic Login


 / Published in: PHP
 

URL: http://www.dynamicdrive.com/forums/showthread.php?t=28358

  1. <?php
  2. if($_POST['user']) {
  3. if(($_POST['user'] == "Username1") && ($_POST['pass'] == "Password1")) header("Location: http://the page to go to.com");
  4. else if(($_POST['user'] == "User2") && ($_POST['pass'] == "Password2")) header("Location: http://the page to go to .com");
  5. else header("Location: error.htm");
  6. } else {
  7. ?>
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  9. <html>
  10. <head>
  11. <title>php log in script</title>
  12. </head>
  13.  
  14.  
  15.  
  16.  
  17. <body>
  18. <br><br>
  19. <center>
  20. <font size= "6">Please Log In Below</font><br><br><br>
  21. <form action="<?=$PHP_SELF?>" method="post">
  22. <p>Username: <input type="text" name="user"/>
  23. Password: <input type="password" name="pass"/>
  24. <input type= "submit" value= "Log In"/></p>
  25. </form>
  26. </center>
  27. </body>
  28. </html>
  29. <?php } ?>

Report this snippet  

You need to login to post a comment.