<?php
/*
将特殊字符串进行转换ftbbs_request($username);
*/
Function ftbbs_request($var_name){
   if (get_magic_quotes_gpc()==0){ //系统不支持自动转换
	  Return (addslashes($var_name)); //进行转换
	  }
   else{
	  Return ($var_name);
	  }
 }
/*************************
判断传递的$_GET变量中是否含有非法字符
功能：防注入
**************************/
$ArrChar=array("'",";","union","and","insert","delete","drop","char","select","from","update","unlink","load_file","script");
$GoUrl="";
function FunStringExist($StrFiltrate,$ArrChar){
foreach ($ArrChar as $key=>$value){
    if (eregi($value,$StrFiltrate)){
        return true;
    }
  }
return false;
}

if(function_exists(array_merge)){
	$ArrGet=array_merge($HTTP_GET_VARS);
}else{
    foreach($HTTP_GET_VARS as $key=>$value){
        $ArrGet[]=$value;
    }
}

foreach($ArrGet as $key=>$value){
    if (FunStringExist($value,$ArrChar)){
        echo "<script language=\"javascript\">alert(\"System error\");</script>";
        if (empty($StrGoUrl)){
        echo "<script language=\"javascript\">history.go(-1);</script>";
        }else{
        echo "<script language=\"javascript\">window.location=\"".$GoUrl."\";</script>";
        }
        exit;
    }
}
?>