Advertisement
Guest User

AZZ is a dickhead

a guest
May 11th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.40 KB | None | 0 0
  1. <?php
  2.  
  3. // $sql = "INSERT INTO `users` (`id`, `account`, `password`, `created`) VALUES (NULL, \'hoi\', \'hoi\', CURRENT_TIMESTAMP)";
  4. // $sql = SELECT * FROM `users` WHERE `account` = "hoi" AND `password` = "hoi";
  5. // $sql = SELECT * FROM `users` WHERE `account` = "$_POST["username"]" AND `password` = "$_POST["password"]";
  6.  
  7. // $render = " ";
  8. // $servername = "localhost";
  9. // $username = "root";
  10. // $password = "";
  11. // $dbname = "project1_db";
  12.  
  13.  
  14. // $query = "SELECT * FROM `user` WHERE username='$username' and password='$password'";
  15.  
  16. //     // Create connection
  17. //     $conn = new mysqli($servername, $username, $password, $dbname);
  18. //     // Check connection
  19. //     if (!$conn) {
  20. //         die("Connection failed: " . mysqli_connect_error());
  21. //     }
  22.  
  23. //     $sql = "SELECT `id`, `account`, `password`, `created` FROM users";
  24. //     $result =mysqli_query($conn, $sql);
  25.  
  26. //     if (mysqli_num_rows($result) > 0) {
  27. //         // output data of each row
  28. //         while($row = mysqli_fetch_assoc($result)) {
  29. //             $render = "<dr>id: " . $row["id"]. " Username: " . $row["account"]. " Password: " . $row["password"]. " Timestamp: " .$row["created"]. "<br>";
  30. //         }
  31. //     } else {
  32. //         $render = "0 results";
  33. //     }
  34.  
  35.  
  36. function logon() {
  37.  
  38.     $result = " ";
  39.  
  40.     if (isset($_POST["logoff"])) {
  41.         //unset($_SESSION);
  42.         //$_SESSION = array();
  43.         //session_destroy();
  44.         session_unset();
  45.     }
  46.     if (isset($_POST['logon']) && $_POST['username']== "UR USERNAME" && $_POST['Password']== "UR PASSWORD")
  47.     {
  48.         $_SESSION['logon'] = true;
  49.  
  50.     }
  51.  
  52.     if (isset($_SESSION['logon']) == true) {
  53.         $form  = '<form action="" method="post">';
  54.         $form .= '<div class="modal-inner">';
  55.         $form .= '<input type="submit" name="logoff" value="logoff">';
  56.         $form .= '</div></form>';
  57.     }
  58.     else {
  59.         $form  = '<form  action="" method="post">';
  60.         $form .= '<table><tbody>';
  61.         $form .= '<h2>Login</h2><br>';
  62.         $form .= '<tr><td><input type="text" name="username" placeholder="Username"><br></td></tr>';
  63.         $form .= '<tr><td><input type="password" name="Password" placeholder="Password"><br></td></tr>';
  64.         $form .= '<tr>';
  65.         $form .= '<td><input type="submit" name="logon" value="Login"></td>';
  66.         $form .= '</tr></table></tbody></form>';
  67.     }
  68.     return $result . $form;
  69. }
  70.  
  71.  
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement