Get the App
SLTechnology News&Howtos  ›  Development  › 

How does php filter post and get sensitive data in batches

Shulou Source: shulou.com Published: 2022-06-03 15:44:46 10月01日 Update

This article mainly introduces "how php filters post and get sensitive data in batches". In daily operation, I believe many people have doubts about how php batch filters post and get sensitive data. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "how php batch filters post and get sensitive data". Next, please follow the editor to study!

Function code:

The copy code is as follows:

/ / php batch filter post,get sensitive data

If (get_magic_quotes_gpc ()) {

$_ GET = stripslashes_array ($_ GET)

$_ POST = stripslashes_array ($_ POST)

}

Function stripslashes_array (& $array) {

While (list ($key,$var) = each ($array)) {

If ($key! = 'argc' & & $key! =' argv' & & (strtoupper ($key)! = $key | | '.intval ($key) = = "$key") {) {

If (is_string ($var)) {

$array [$key] = stripslashes ($var)

}

If (is_array ($var)) {

$array [$key] = stripslashes_array ($var)

}

}

}

Return $array

}

/ / filter

Function htmlencode ($str) {

If (empty ($str)) return

If ($str== "") return $str

$str=trim ($str)

$str=str_replace ("&", $str)

$str=str_replace (">", $str)

$str=str_replace ("", $str)

$str=str_replace (",", $str)

$str = str_replace ("", ">", $str)

$str=str_replace ("

Tags: Keywords keywords code data content normal array learning retrieval precision two for files services important functions characters strings more tags Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Tech Info Linux Apple vpn