Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. include('config.php');
  3.  
  4. if(!empty($_REQUEST['Password']) and !empty($_REQUEST['Login']))
  5. {
  6. $login = $_REQUEST['Login'];
  7. $password = $_REQUEST['Password'];
  8.  
  9. $query = 'SELECT * FROM `accounts` WHERE `Login` ="'.$login.'" AND `Password` ="'.$password.'"';
  10. $result = mysqli_query($mysqli,$query);
  11. $user = mysqli_fetch_assoc($result);
  12.  
  13. if(!empty($user))
  14. {
  15. session_start();
  16. header('Location: auth.php');
  17. $_SESSION['auth'] = true;
  18. $_SESSION['ID'] = $user['ID'];
  19. $_SESSION['Login'] = $user['Login'];
  20. echo 'Привет, '.$_SESSION['Login'];
  21. }
  22. else
  23. {
  24. echo "Логин или пароль неверны.";
  25. }
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement