PHP excessive disabling characters, before entering the database (PHP code function)
-
- // PHP excessive disabling characters before entering the database (php code function)
-
-
- Function safe_str ($ str ){
- $ Array = array ('receive. php ', 'select', 'insert', 'update', 'delete', 'Union', 'into', 'load _ file', 'outfile ');
- If (! Is_array ($ str )){
- Foreach ($ array as $ v ){
- $ Str = preg_replace ("# ({$ v}) # I", "-\ $ Beckham-", $ str );
- }
- // $ Str = preg_replace ("! [] [XX] ([A-Fa-f0-9])! "," X \ $ Beckham ", $ str );
- $ Str = str_replace ("'", ''', $ str );
- $ Str = str_replace ('"', '"', $ str );
- $ Str = str_replace ("--", '-', $ str );
- $ Str = str_replace ("\ *", '\-*', $ str );
- $ Str = str_replace ("\\\\", 'monxin _ backslash ', $ str );
- $ R = $ str;
- } Else {
- $ R = array ();
- Foreach ($ str as $ key => $ value ){
- // $ Key = safe_str ($ key );
- $ R [$ key] = safe_str ($ value );
- }
- }
-
- Return $ r;
- }
-
|
PHP