class Security {
function sanitize_input() { // почистване на всички входни данни които влизат в PHP
foreach($_GET as &$g) { //променливи от URL
if ( (!(int)$g) && !(is_array($g)) )
{
strip_tags($g);
addslashes($g);
htmlspecialchars($g);
}
}
foreach($_POST as &$g) { // данни от форми
if ( (!(int)$g) && !(is_array($g)) )
{
strip_tags($g);
addslashes($g);
htmlspecialchars($g);
}
}
foreach($_COOKIE as &$g) { // данни от бисквитки
if ( (!(int)$g) && !(is_array($g)) )
{
strip_tags($g);
addslashes($g);
htmlspecialchars($g);
}
}
foreach($_SERVER as &$g) { // други данни подавани в HTTP заявката
if ( (!(int)$g) && !(is_array($g)) )
{
strip_tags($g);
addslashes($g);
htmlspecialchars($g);
}
}
}
}