Guest User

Untitled

a guest
Nov 23rd, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /storage/ssd1/425/3721425/public_html/login.php on line 22
  2.  
  3. <?php
  4. session_start();
  5. error_reporting(E_ALL);
  6. ini_set('display_errors', 1);
  7. include_once('module/config.php');
  8. if(isset($_SESSION['id'])){
  9. header("location: index.php");
  10. }
  11. if(isset($_POST['login'])){
  12. $identification = $_POST['username'];
  13. $identification = mysqli_real_escape_string($link, $identification);
  14. $password = $_POST['password'];
  15. $password = mysqli_real_escape_string($link, $password);
  16.  
  17. if($identification == "" || $password == "")
  18. {
  19. echo "Error Username / Password Wrong !";
  20. }else {
  21.  
  22. $sql ="SELECT * FROM usrr WHERE usrname='$identification' LIMIT 1";
  23. $query = mysqli_query($link, $sql);
  24. $row = mysqli_fetch_array($query);
  25. $id= $row['uid'];
  26. $db_pss =$row['usrpass'];
  27. if (password_verify($password, $db_pss)){
  28. $_SESSION['id'] = $id;
  29. $_SESSION['name'] = $row['name'];
  30. header("location: index.php");
  31.  
  32. }else{
  33. echo "Error Username / Password Wrong !";
  34. }
  35.  
  36. }
  37. }
  38.  
  39.  
  40. ?>
  41.  
  42.  
  43. <form method="post">
  44. <label>username : </label>
  45. <input type="text" name="username"><br/>
  46. <label>password : </label>
  47. <input type="password" name="password"><br/>
  48. <input type="submit" name="login" value="login">
  49.  
  50. </form>
Add Comment
Please, Sign In to add comment