I want to protect my site against attack from malicious users who try to attack the site via input forms.
Will this function do the job?
Much tahnks in advance! I know the gurus here will help!PHP Code:function GetVar($name, $source, $default = "", $protect = true){
$var = "";
$souce = strtoupper($source);
switch($source){
default:
case "REQUEST":
$var = isset($_REQUEST[$name]) ? ($protect ? mysql_real_escape_string($_REQUEST[$name]) : $_REQUEST[$name]) : $default;
break;
case "GET":
$var = isset($_GET[$name]) ? ($protect ? mysql_real_escape_string($_GET[$name]) : $_GET[$name]) : $default;
break;
case "POST":
$var = isset($_POST[$name]) ? ($protect ? mysql_real_escape_string($_POST[$name]) : $_POST[$name]) : $default;
break;
}
return $var;
}
Submit Your Article
Forum Rules

Reply With Quote
