Guest User

Untitled

a guest
Jan 5th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2.  
  3. $mysql_server = "localhost";
  4. $mysql_user = "";
  5. $mysql_password = "";
  6. $mysql_database = "7";
  7.  
  8. $connect = mysql_connect($mysql_server, $mysql_user, $mysql_password);
  9. mysql_select_db($mysql_database, $connect);
  10.  
  11. //Säkerhet
  12. $post = $_POST;
  13. function db_escape ($post)
  14. {
  15.    if (is_string($post)) {
  16.      if (get_magic_quotes_gpc()) {
  17.         $post = stripslashes($post);
  18.      }
  19.      return mysql_real_escape_string($post);
  20.    }
  21.    
  22.    foreach ($post as $key => $val) {
  23.       $post[$key] = db_escape($val);
  24.    }
  25.    
  26.    return $post;
  27. }
  28. ?>
Add Comment
Please, Sign In to add comment