Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <?php include 'db.php'; ?>
  2.  
  3. <!DOCTYPE html>
  4. <html lang="en">
  5. <head>
  6. <meta charset="UTF-8">
  7. <title>Login page</title>
  8. <link rel="stylesheet" href="main.css">
  9. </head>
  10. <body>
  11. <form action="login_process.php" method="post" onsubmit="return validate_form(this)">
  12. <div class="container">
  13. <?php
  14. if(isset($_GET['error']) && $_GET['error']=='yes') {
  15. echo 'Incorrect Password ! try again !!';
  16. }
  17. if(isset($_GET['error']) && $_GET['error']=='username'){
  18. echo 'Wrong username';
  19. }
  20. ?>
  21.  
  22. <h2>Log in</h2>
  23. <label><b>Username</b></label>
  24. <input type="text" placeholder="Enter Username" name="username" >
  25.  
  26. <label><b>Password</b></label>
  27. <input type="password" placeholder="Enter Password" name="password" >
  28.  
  29. <button type="submit">Login</button>
  30. <input type="checkbox" checked="checked"> Remember me
  31. </div>
  32.  
  33. <div class="container" style="background-color:#f1f1f1">
  34. <a href="logout.php">Logout</a>
  35. </div>
  36. </form>
  37.  
  38. <script>
  39.  
  40. function validate_required(field, alerttxt){
  41. with(field){
  42. if(value==null||value==""){
  43. alert(alerttxt); return false;
  44. }else{
  45. return true;
  46. }
  47. }
  48. }
  49.  
  50. function validate_form(thisform){
  51. with(thisform){
  52. if(validate_required(username,"username must be filled out")==false){
  53. username.focus();return false;
  54. }else if(validate_required(password,"password must be filled out")==false){
  55. password.focus(); return false;
  56. }
  57. }
  58. }
  59.  
  60. </script>
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement