Guest User

Untitled

a guest
Apr 18th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2. require_once 'login.php';
  3. $conn = new mysqli($hn, $un, $pw, $db);
  4. if ($conn->connect_error) die($conn->connect_error);
  5.  
  6. $user = mysql_entities_fix_string($conn, $_POST['user']);
  7. $pass = mysql_entities_fix_string($conn, $_POST['pass']);
  8. $query = "SELECT * FROM users WHERE user='$user' AND pass='$pass'";
  9.  
  10. //Etc…
  11.  
  12. function mysql_entities_fix_string($conn, $string)
  13. {
  14. return htmlentities(mysql_fix_string($conn, $string));
  15. }
  16.  
  17. function mysql_fix_string($conn, $string)
  18. {
  19. if (get_magic_quotes_gpc()) $string = stripslashes($string);
  20. return $conn->real_escape_string($string);
  21. }
  22. ?>
Add Comment
Please, Sign In to add comment