Advertisement
Guest User

login system

a guest
Aug 29th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include('dbconn.php');
  4. $error_msg = "";
  5. $sumbit = filter_input(INPUT_POST, 'submit');
  6. if (isset($sumbit)) {
  7. $username = filter_input(INPUT_POST, 'username');
  8. $password = filter_input(INPUT_POST, 'password');
  9.  
  10.  
  11. if ($username != "" || $password != "") {
  12.  
  13. $result = $db->query("SELECT `admin_login_id`, `admin_login_username`, `admin_login_status` FROM `acl_admin_login` WHERE `admin_login_username`='" . $username . "' and `admin_login_password`='" . md5($password) . "'");
  14. if ($result->num_rows > 0) {
  15. $row = $result->fetch_assoc();
  16. if ($row['admin_login_status'] == 1) {
  17. $_SESSION['name'] = $row['admin_login_username'];
  18. header("Location:aaaa.php");
  19. } else {
  20. $error_msg = "Sorry, we couldn't allow that username.";
  21. }
  22. } else {
  23. $error_msg = "username or password are wrong";
  24. }
  25. } else {
  26. $error_msg = "Please fill username & password";
  27. }
  28. }
  29. ?>
  30. <!DOCTYPE html>
  31. <html>
  32. <head>
  33. <title>Testing</title>
  34. <link rel="shortcut icon" href="images/logo.png" />
  35. <meta charset="UTF-8">
  36. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  37. <link rel="stylesheet" href="css/bootstrap.min.css">
  38. <link href='https://fonts.googleapis.com/css?family=Asset|Diplomata+SC|Montserrat|Merriweather:400,900,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
  39. <link rel="stylesheet" href="css/style.css">
  40. </head>
  41. <body>
  42. <div class="">
  43. <form class="form-signin col-lg-offset-3 col-lg-6" id="login-form" action="login.php"
  44. method="POST">
  45. <h2 class="form-signin-heading">Login</h2>
  46. <label class="sr-only" for="inputUsername">Username</label>
  47. <input type="text" autofocus="" name="username" required="" oninvalid="this.setCustomValidity('Please insert your username')" placeholder="username" class="form-control" id="inputUsername">
  48. <label class="sr-only" for="inputPassword">Password</label>
  49. <input type="password" oninvalid="this.setCustomValidity('Please insert your password')" required="" name="password" placeholder="Password" class="form-control" id="inputPassword">
  50. <br>
  51. <button type="submit" class="btn btn-lg btn-primary btn-block submit" name="submit" >Sign in</button>
  52. <?php
  53. if ($error_msg != null || $error_msg != '') {
  54. echo "<br><p style=\"color:red;\font-size:20px;\">" . $error_msg . "</p>";
  55. }
  56. ?>
  57. </form>
  58. </div>
  59.  
  60. <script src="js/jquery-2.2.0.min.js"></script>
  61. <script src="js/bootstrap.min.js"></script>
  62. <script src="js/main.js"></script>
  63. </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement