[Proteção] Script para proteger seu Habbo Pirata! 14.04.13 11:05
Bom galera, está aqui 1 dos 5 scripts que vai ter na Kash CMS v2 que não teve na v1 nem na v1.5
Use e Abuse xd
Ele não faz milagres, mas ajuda bastante ;)
OBS: Para o script funcionar você deve por o protect antes dos POST
Use e Abuse xd
- Código:
function protect( $str )
{
/**
* USE E DESFRUTE! KASH CMS
*/
if( !is_array( $str ) ) {
$str = preg_replace("/(from|select|insert|delete|where|drop table|show tables)/i","",$str);
$str = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $str);
$str = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $str);
$str = str_replace("<script","",$str);
$str = str_replace("script>","",$str);
$str = str_replace("<Script","",$str);
$str = str_replace("Script>","",$str);
$str = trim($str);
$tbl = get_html_translation_table(HTML_ENTITIES);
$tbl = array_flip($tbl);
$str = addslashes($str);
$str = strip_tags($str);
return strtr($str, $tbl);
}
else return $str;
}
$variavel = protect( $_POST['variavel_exemplo'] ); //<--- Isso é um exemplo
Ele não faz milagres, mas ajuda bastante ;)
OBS: Para o script funcionar você deve por o protect antes dos POST