<?php
if (!defined('HUCART_COM')) exit('HuCart.COM No direct script access allowed');
class Safety_lib
{
	
	function del_ext(&$val){
		//'-','_',
		$delstr=array('~','*','^','%','$','#', '`','\'',"\"",'+','=','/','\\','&','!','?','<','>','(',')','[',']', '\x0d','\x0a','\x20');
		$val = str_replace($delstr,'',trim($val));
		$val = substr($val,0,150);
		return  $val ;
	}

	function security_sumbit()
	{
		$strServerName 	= $_SERVER["SERVER_NAME"];
		$intLen 		= strlen($strServerName);
		$strFromURL 	= $_SERVER["HTTP_REFERER"];
		$strFromURL 	= substr($strFromURL, 7, $intLen);
		if($strFromURL != $strServerName)
		{
			die("对不起，本站禁止跨站提交信息！");
		}
	}
	
}