Topic: my small "security" code
I have this in /include/common.php at the top. It prevents from some hacking attempts
$_COOKIE= array_map("strip_tags", $_COOKIE);
$_GET = array_map("strip_tags", $_GET);
function hacked($data)
{
$data2 = $data;
$data = strtolower($data);
IF(ereg('\.\./', $data))
{
die('../ in GET');
}
IF(ereg('union', $data))
{
die('union in GET');
}
IF(ereg('select', $data))
{
die('SELECT in GET');
}
IF(ereg('drop', $data))
{
die('DROP in GET');
}
IF(ereg('1=', $data))
{
die('1= in GET');
}
return $data2;
}
$_GET = array_map("hacked", $_GET);
array_map executes a function on each array element The code will strip any tags in _GET (links) and cookies and will die if it will find ../ select, drop, 1=, union in links (SQL injections etc.)