Advertisement
Guest User

Untitled

a guest
Oct 11th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Admin Login</title>
  4.  
  5. <link href="styleforlogin.css"rel="stylesheet" type="text/css">
  6. </head>
  7. <body>
  8. <div class="container">
  9. <img src ="logo.png">
  10. <form action="account.php" method="post">
  11. <div class="form-input">
  12. <input type="text" name="username" placeholder="Enter Username">
  13. </div>
  14. <div>
  15. <input type="password" name="password" id="txtPassword" placeholder="Enter Password">
  16.  
  17. <tr>
  18. <td>
  19. <label for="chkShowPassword">
  20. <h5><input type="checkbox" id="chkShowPassword"/>
  21. Show password</h5></label>
  22.  
  23. </td>
  24. </tr>
  25. <input type="submit" name="submit" value="LOG IN" class="btn-login">
  26. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  27. <script type="text/javascript">
  28. $(function () {
  29. $("#chkShowPassword").bind("click", function () {
  30. var txtPassword = $("#txtPassword");
  31. if ($(this).is(":checked")) {
  32. txtPassword.after('<input onchange = "PasswordChanged(this);" id = "txt_' + txtPassword.attr("id") + '" type = "text" value = "' + txtPassword.val() + '" />');
  33. txtPassword.hide();
  34. } else {
  35. txtPassword.val(txtPassword.next().val());
  36. txtPassword.next().remove();
  37. txtPassword.show();
  38. }
  39. });
  40. });
  41. function PasswordChanged(txt) {
  42. $(txt).prev().val($(txt).val());
  43. }
  44. </script>
  45. </center></form></div>
  46.  
  47. <?php
  48. if (isset($_POST['submit']))
  49. {
  50. include('adminconnect.php');
  51. $un = $_POST['username'];
  52. $p = $_POST['password'];
  53. if(!empty($_POST['username']) || !empty($_POST['password']))
  54. {
  55. $query = "SELECT admin_id, first_name, last_name FROM tb_admin WHERE username='$un' AND password='$p'";
  56. $result = @mysql_query($query);
  57. $row = mysql_fetch_array($result,MYSQL_NUM);
  58. if ($row)
  59. {
  60. echo "<script>alert('Redirecting to home page')</script>";
  61. {
  62. header('location:loginhome2.php');
  63. }
  64. exit();
  65. }
  66. else
  67. {
  68. echo '<br><center><mark>The username and password entered do not match.</center></mark>';
  69. }
  70. }
  71. else
  72. echo '<br><center><mark>Please enter username and/or password.</center></mark>';
  73. mysql_close();
  74. }
  75. ?>
  76. </body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement