fork download
  1. <?php
  2.  
  3. if (isset($_POST['submit'])) {
  4.  
  5. include('config.php');
  6. $link = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name']);
  7.  
  8. $login = mysqli_real_escape_string($link, $_POST['username']);
  9. $password = trim(md5($_POST['password']));
  10.  
  11. $query = "SELECT user_id, user_login, user_password FROM users WHERE user_login = '" . $login . "' LIMIT 1";
  12.  
  13. $queryResult = mysqli_query($link, $query) or die(mysqli_error($link));
  14. $dbData = mysqli_fetch_assoc($queryResult);
  15.  
  16. $validHash = $dbData['user_password'];
  17.  
  18. if (($dbData == NULL) or ($validHash != $password)) {
  19. echo "Неправильное имя пользователя или пароль";
  20. } else {
  21. $_SESSION['user_login'] = $dbData['user_login'];
  22. $_SESSION['user_id'] = $dbData['user_id'];
  23. header('Location: /index.php');
  24. }
  25.  
  26. }
  27.  
  28. include ('login.html');
  29.  
  30. ?>
Success #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  include(login.html): failed to open stream: No such file or directory in /home/AlghqZ/prog.php on line 30
PHP Warning:  include(): Failed opening 'login.html' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/AlghqZ/prog.php on line 30