Advertisement
Guest User

Untitled

a guest
Aug 12th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Simative | Login</title>
  4. <link rel="shortcut icon" type="image/png" href="square.png">
  5. <link href="login.css" rel="stylesheet">
  6.  
  7.  
  8. </head>
  9. <body>
  10.  
  11.  
  12.  
  13. <form action="home.php" method="post">
  14. <div class="container">
  15. <h4>Login</h4>
  16. <hr>
  17. <center><input type="text" placeholder="Username" name="Username" required></center>
  18. <center><input type="text" placeholder="Email" name="Email" required></center>
  19. <center><input type="text" placeholder="Password" name="Password" required></center>
  20. <center><input type="submit" name="submit"></center>
  21. <center><p>
  22. Have an account?
  23. <center><a href="register.php">Haven't got an account? Why not sign up!</a></p></center>
  24.  
  25.  
  26. </div>
  27. </form>
  28. </body>
  29. </html>
  30.  
  31.  
  32.  
  33. <?php
  34.  
  35. include("connect.php");
  36. session_start();
  37. // https://www.tutorialspoint.com/php/php_mysql_login.htm
  38. if($_SERVER["REQUEST_METHOD"] == "POST") {
  39.  
  40. $myusername = mysqli_real_escape_string($db,$_POST['uname']);
  41. $mypassword = mysqli_real_escape_string($db,$_POST['pword']);
  42.  
  43. $sql = "SELECT id FROM staff WHERE username = '$myusername' and password = '$mypassword'";
  44. $result = mysqli_query($db,$sql);
  45. $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  46. $active = $row['active'];
  47.  
  48. $count = mysqli_num_rows($result);
  49.  
  50. if($count == 1) {
  51. $_SESSION['login_user'] = $myusername;
  52. header("Location: home.php");
  53. die();
  54. }else {
  55. $error = "Your Login Name or Password is invalid";
  56. }
  57. }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement