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

PHP cleans malicious code input to database

WBOY
Release: 2016-07-25 08:45:22
Original
915 people have browsed it
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


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template