Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $user = "root";
  4. $pass = "pass";
  5. $db = "SheetPal";
  6. mysql_connect($host, $user, $pass);
  7. mysql_select_db($db);
  8.  
  9. if (isset($_POST['submit'])){
  10. $username = $_POST['username'];
  11. $password = $_POST['password'];
  12. $sql = "SELECT * FROM users WHERE username ='".$username."' AND password = '".$password."' LIMIT 1";
  13. $res = mysql_query($sql);
  14. if(mysql_num_rows($res) == 1){
  15. echo "You have successfully logged in.";
  16. exit();
  17. }
  18. else {
  19. echo"Invalid login information.";
  20. exit();
  21. }
  22. }
  23. ?>
  24.  
  25. <!DOCTYPE html>
  26. <html >
  27. <head>
  28. <meta charset="UTF-8">
  29. <title>Login Form</title>
  30. <link rel="stylesheet" href="css/login.css">
  31.  
  32. </head>
  33.  
  34. <body>
  35.  
  36. <body>
  37. <div class="login">
  38. <div class="login-screen">
  39. <div class="app-title">
  40. <h1>Login</h1>
  41. </div>
  42.  
  43. <div class="login-form" role="form" method="post" action="test.php">
  44. <div class="control-group">
  45. <input type="text" class="login-field" value="" placeholder="username" name="username">
  46. <label class="login-field-icon fui-user" for="login-name"></label>
  47. </div>
  48.  
  49. <div class="control-group">
  50. <input type="password" class="login-field" value="" placeholder="password" name="password">
  51. <label class="login-field-icon fui-lock" for="login-pass"></label>
  52. </div>
  53.  
  54. <div class="control-group">
  55. <input id="submit" name="submit" type="submit" value="Login" class="btn btn-primary">
  56. </div>
  57.  
  58. <!-- <a class="btn btn-primary btn-large btn-block" href="test.php">login</a>
  59. <a class="login-link" href="#">Lost your password?</a> -->
  60. </div>
  61. </div>
  62. </div>
  63. </body>
  64.  
  65.  
  66.  
  67.  
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement