Файл: niz/funk_hacked.php
Строк: 48
<?php
class InitVars {
# Недопустимые слова в запросахINSERT
var $deny_words = array('UNION','CHAR','INSERT','DELETE','SELECT','UPDATE','GROUP','ORDER','BENCHMARK','union','char','insert','delete','select','update','group','order','benchmark');
function InitVars() {
}
# Метод конвентирует суперглобальные массивы $_POST, $_GET в перемнные
# Например : $_GET['psw'] будет переобразовано в $psw с тем же значением
function convertArray2Vars () {
foreach($_GET as $_ind => $_val) {
global $$_ind;
if(is_array($$_ind)) $$_ind = htmlspecialchars(stripslashes($_val));
}
foreach($_POST as $_ind => $_val) {
global $$_ind;
if(is_array($$_ind)) $$_ind = htmlspecialchars(stripslashes($_val));
}
}
# Метод проверяет $_GET и $_POST переменные на наличие опасных данных и SQL инъекций
function checkVars() {
//Проверка опасных данных.
foreach($_GET as $_ind => $_val) {
$_GET[$_ind] = htmlspecialchars(stripslashes($_val));
$exp = explode(" ",$_GET[$_ind]);
foreach($exp as $ind => $val) {
if(in_array($val,$this->deny_words)) $this->antihack("Произошла ошибка системы!");
}
}
foreach($_POST as $_ind => $_val) {
$_POST[$_ind] = htmlspecialchars(stripslashes($_val));
$exp = explode(" ",$_POST[$_ind]);
foreach($exp as $ind => $val) {
if(in_array($val,$this->deny_words)) $this->antihack("Произошла ошибка системы!");
}
}
}
function antihack($msg) {
echo"Произошла ошибка системы!</font>";
echo'<meta http-equiv="refresh" content="0; url=error.php">';
die;
}
}
foreach ($_GET as $check_url) { // что бы ШкоЛоло-Хацкеры не выебывались
if (!is_string($check_url) || !preg_match('#^(?:[a-z0-9_-/]+|.+("?!/))*$#i', $check_url)) {
echo"Произошла ошибка системы!</font>";
echo'<meta http-equiv="refresh" content="0; url=error.php">';
exit;
}
}
unset($check_url);
?>