Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <?php
  2. $connection = mysqli_connect("localhost", "root", "", "authdb");
  3. if($_SERVER['REQUEST_METHOD']==="POST") {
  4.  
  5. $username = mysqli_real_escape_string($connection, $_POST['username']);
  6. $pass = mysqli_real_escape_string($connection, $_POST['pass']);
  7. $email = mysqli_real_escape_string($connection, $_POST['email']);
  8.  
  9. if($connection) {
  10.  
  11. $query = " SELECT username, pass FROM users WHERE username LIKE '$username' ";
  12. $res = mysqli_query($connection, $query);
  13. $data = mysqli_fetch_assoc($res);
  14.  
  15. if( $pass === $data['pass'] ) {
  16. echo 'True!';
  17. } else {
  18. echo 'You Are Stupied.';
  19. }
  20.  
  21.  
  22.  
  23. // $query = "INSERT INTO users (username, pass, email )
  24. // VALUES ( '$username',$pass, '$email' );";
  25. //
  26. // $rows_affected = mysqli_multi_query($connection, $query);
  27. // if ( $rows_affected ) {
  28. // echo "success";
  29. // } else {
  30. // die("fuck you"." - ". mysqli_error($connection)) ;
  31. // }
  32. } else {
  33. die("Connection Faild!");
  34. }
  35. }
  36. ?>
  37.  
  38. <!DOCTYPE html>
  39. <html lang="en">
  40.  
  41. <head>
  42. <title>Login</title>
  43. <link rel="stylesheet" type="text/css" href="./css/style.css">
  44. <link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,700" rel="stylesheet">
  45. </head>
  46.  
  47. <body>
  48. <div id="login-page">
  49. <div id="form-box">
  50. <form class="login-form" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  51. <input type="text" name="username" placeholder="username" />
  52. <input type="password" name="pass" placeholder="password" />
  53. <input type="email" name="email" placeholder="E-mail" />
  54. <button>LOGIN</button>
  55. <p class="message">Not registered? <a href="#">Create an account</a></p>
  56. </form>
  57. </div>
  58. </div>
  59. </body>
  60.  
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement