<?php
	error_reporting("E_ALL & ~E_NOTICE");
	//设置当前时区为中国
	ini_set('date.timezone','PRC');
	ini_set("display_errors","on");//这里设置在浏览器中显不显示用于调试用的错误信息
	ini_set("magic_quotes_gpc","off");//本系统中用addslashes函数
	define('ROOT_PATH', substr(dirname(__FILE__), 0, -13));
	if(!file_exists(ROOT_PATH . "install/lock")){
		$install_path = "";
		if(!file_exists("install/"))
			$install_path = "../install/";
		else
			$install_path = "install/";
		die("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script>alert('请先安装网站');location.href='$install_path';</script>");
	}
	include_once("conn.php");
	include_once("function.php");
	//PHP防注入，要过滤的非法字符
	$ArrFiltrate=array("\'\'",";","union","=");
	//出错后要跳转的url,不填则默认前一页
	$StrGoUrl="";
	//是否存在数组中的值
	function FunStringExist($StrFiltrate,$ArrFiltrate){
		foreach ($ArrFiltrate as $key=>$value){
			if (eregi($value,$StrFiltrate)){
				return true;
			}
		}
		return false;
	}

	//只对GET数据进行分析，因为POST数据要选择性地分析
	if(function_exists(array_merge)){
		$ArrPostAndGet=$_GET; 
	}else{
		foreach($_GET as $key=>$value){ 
			$ArrPostAndGet[]=$value;
		}
	}

	//验证开始 
	foreach($ArrPostAndGet as $key=>$value){ 
		if (FunStringExist($value,$ArrFiltrate)){ 
			echo "<script language=\"javascript\">alert(\"HMCSS提示，不可以输入以下非法字符：\',\;,\=和union\");</script>"; 
			if (empty($StrGoUrl)){ 
				echo "<script language=\"javascript\">history.go(-1);</script>"; 
			}else{ 
				echo "<script language=\"javascript\">window.location=" . $StrGoUrl . ";</script>"; 
			} 
			exit; 
		} 
	}
?>