Home >Backend Development >PHP Tutorial >PHP cleans malicious code input to database

PHP cleans malicious code input to database

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 08:45:22941browse
It can clean all input data and reduce the chance of code injection.
  1. function sanitize_input_data($input_data) {
  2. $input_data = trim(htmlentities(strip_tags($input_data,“,”)));
  3. if (get_magic_quotes_gpc())
  4. $input_data = stripslashes($input_data);
  5. $ input_data = mysql_real_escape_string($input_data);
  6. return $input_data;
  7. }
Copy code

Malicious code, PHP


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn