Advertisement
Guest User

Untitled

a guest
Apr 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php // fixString.php
  2. require_once 'login.php';
  3. $connection = new mysqli($hn, $un, $pw, $db);
  4. if ($connection->connect_error)
  5. die($connection->connect_error);
  6.  
  7. var_dump($_POST);
  8. $user = mysql_fix_string($connection, $_POST['user']);
  9. $pass = mysql_fix_string($connection, $_POST['pass']);
  10. $query = "SELECT * FROM customers WHERE name='$user' AND isbn='$pass'";
  11. $result = $connection->query($query);
  12. if (!$result)
  13. die($connection->error);
  14.  
  15. echo $user . "<br>";
  16. echo $pass . "<br>";
  17.  
  18. function mysql_fix_string($connection, $string)
  19. {
  20. if (get_magic_quotes_gpc()) // returns TRUE if magic quotes are active
  21. $string = stripslashes($string);
  22. return $connection->real_escape_string($string);
  23. }
  24. ?>
  25.  
  26. array(0) { }
  27. Notice: Undefined index: user in C:xampphtdocsPHPfixString.php on line 8
  28.  
  29. Notice: Undefined index: pass in C:xampphtdocsPHPfixString.php on line 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement