php - Html injection in my site -
well, have big problem: day inserting html code in index.php , don't know how, code inserted:
<iframe src=**bad url here** width=0 height=0 frameborder=0></iframe>
i tried prevent problem:
$_get = sanitize::filter($_get); $_post = sanitize::filter($_post)
my sanitize class filter content in $_get , $_post problem continue.
this sanitize file:
abstract class sanitize { /** * filter * * @param mixed $value * @param array $modes * @return mixed * @static * @since 1.0 */ static public function filter($value, $modes = array('sql', 'html')) { if (!is_array($modes)) { $modes = array($modes); } if (is_string($value)) { foreach ($modes $type) { $value = self::_dofilter($value, $type); } return $value; } foreach ($value $key => $tosanatize) { if (is_array($tosanatize)) { $value[$key]= self::filter($tosanatize, $modes); } else { foreach ($modes $type) { $value[$key] = self::_dofilter($tosanatize, $type); } } } return $value; } /** * dofilter * * @param mixed $value * @param array $modes * @return mixed * @static * @since 1.0 */ static protected function _dofilter($value, $mode) { switch ($mode) { case 'html': $value = strip_tags($value); $value = addslashes($value); $value = htmlspecialchars($value); break; case 'sql': $value = preg_replace(sql_regcase('/(from|select|insert|delete|where|drop table|show tables|#|\*| |\\\\)/'),'',$value); $value = trim($value); break; } return $value; } }
and files inserted in public_html folder , don't know how.
Comments
Post a Comment