Get the App
SLTechnology News&Howtos  ›  Development  › 

How to quickly find malicious code in database by php

Shulou Source: shulou.com Published: 2022-06-03 19:45:47 10月03日 Update

This article mainly shows you how to quickly find malicious code in the database php, the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "php how to quickly find malicious code in the database" this article bar.

These are as follows:

The database has been entered with malicious code, and you have to be careful to clean it up in order to keep your database safe. With this super handy feature, you can quickly clean up your database of malicious code.

function cleanInput($input) { $search = array( '@]*?>.*?@ si', // Strip out javascript '@@si', // Strip out HTML tags '@]*?>.*?@ siU', // Strip style tags properly '@@' // Strip multi-line comments ); $output = preg_replace($search, '', $input); return $output; }function sanitize($input) { if (is_array($input)) { foreach($input as $var=>$val) { $output[$var] = sanitize($val); } } else { if (get_magic_quotes_gpc()) { $input = stripslashes($input); } $input = cleanInput($input); $output = mysql_real_escape_string($input); } return $output;}// Usage:$bad_string = "Hi! It's a good day! ";$good_string = sanitize($bad_string);// $good_string returns "Hi! It\'s a good day! "// Also use for getting POST/GET variables$_POST = sanitize($_POST);$_GET = sanitize($_GET); above is"php how to quickly find malicious code in the database "All the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Data database code malicious content articles learning help security functionality understandability more organization knowledge editing industry information information channels channels guarantee Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple MariaDB Huawei Shulou Tech Info