<?php
/**
 *----------------------------------------------------------------------------*
 * 版权所有 2010-2016 HuCart.COM，并保留所有权利。
 * 网站地址: http://Www.HuCart.Com；
 * 作者: HuCart.COM
 *----------------------------------------------------------------------------*
**/
class Security
{
	function Security()
	{
		//缓存
		if($GLOBALS["WebConfig"]["webtmp"]==1)
		{
			$this -> view -> caching = true;
			if($GLOBALS["WebConfig"]["webtmptime"] > 0 ){
				$this -> view -> cache_lifetime = $GLOBALS["WebConfig"]["webtmptime"] ;  
			}else{
				$this -> view -> cache_lifetime = 3600 ;  //60 *  60 * 24
			}
			$this -> view -> cache_dir = ROOT_PATH.$GLOBALS['cache_path'];
		}


		$getmenu = $this -> helper -> get_menu();
		$this -> view -> assign('getmenu',$getmenu);
		
		$getprosort = $this -> personal -> get_prosort();
		$this -> view -> assign('getprosort',$getprosort);

		$getlink = $this -> helper -> get_link();
		$this -> view -> assign('getlink',$getlink);
		
		$getads = $this -> helper -> get_ads( $instr = '1,2,3,4,5,6,7,8,9,10,11' );
		$this -> view -> assign('getads',$getads);
		
		$getuserlink = $GLOBALS['WebSe']->getuserlink();
		$this -> view ->assign('getuserlink',$getuserlink);
		
		//$this -> infolist();
	}


	function infolist()
	{

		$webtitle = $_LANG['webtitle'];
		
		//处理你现在的位置
		$now_address = $_LANG['u_address'].'<a href="'.BASE_WEBURL.'/">'.$_LANG['home'].'</a> > <a href="'.BASE_WEBURL.'?/article.html">'.$_LANG['webtitle'].'</a>';
		
		/*
		$sql_query 	= " SELECT a.*  FROM  ".$this -> db -> prefix."article as a  WHERE  a.art_enabled = 1  and a.art_sysfile = 'security' ORDER BY a.`art_id`  ";
			
		$infodetail 	= $this -> db ->  select_one($sql_query);
		
		if($infodetail["art_title"]!='')
		{
			$webtitle  		= $infodetail["art_title"];
		}*/
		
		$this -> view -> assign('webtitle',$webtitle);
		
		$this -> view -> assign('now_address',$now_address);
		
		$this -> view -> display('security_tpl.html');
	}
	
	function search()
	{
		
		$webtitle = $_LANG['webtitle'];
		
		//处理你现在的位置
		$now_address = $_LANG['u_address'].'<a href="'.BASE_WEBURL.'/">'.$_LANG['home'].'</a> > <a href="'.BASE_WEBURL.'?/article.html">'.$_LANG['webtitle'].'</a>';
		
		$imgcodeval 	= $this -> input -> req["imgcode"];
		$sec_numcodeval = $this -> input -> req["sec_numcode"];
		
		//var_dump($_SESSION["Img"]);
		
		if($imgcodeval!='' and $imgcodeval ==$_SESSION["Img"])
		{
			if($sec_numcodeval!='')
			{
				$sql_query 	= " SELECT *  FROM  ".$this -> db -> prefix."security  WHERE  sec_enabled = 1 AND sec_numcode ='".$sec_numcodeval."'  ORDER BY `sec_id`  ";
				$infodetail 	= $this -> db ->  select_one( $sql_query );
				
				$info["detail"] = "";
				
				if($infodetail["sec_numcode"]!='')
				{
					$info["detail"] = $_LANG['la_secret'].' '.$sec_numcodeval.' '.$_LANG['la_return'].'<br/><span  style="font-weight:bold;color:#FF0000;">'.$infodetail["sec_remark"].'</span>';	
				}else{
					$info["detail"] = $_LANG['la_secret'].' '.$sec_numcodeval.' '.$_LANG['la_return'].'<br/><span  style="font-weight:bold;color:#FF0000;">'. $_LANG['sec_error']."</span>";	
				}

				$this -> view -> assign('info',$info);
				$this -> view -> assign('webtitle',$webtitle);
				$this -> view -> assign('now_address',$now_address);	
				
				$this -> view -> display('security_tpl.html');
				
			}else{
				//没有输入防伪码
				$this -> view -> assign('info_title',$_LANG['la_notinput']);
				$this -> view -> assign('URL_TIME',URL_TIME);
				$this -> view -> assign('get_url',BASE_WEBURL."/?security.html");
				$this -> view -> display('suggestion.tpl');
			}
		}else{
			//验证码有误
			$this -> view -> assign('info_title',$_LANG['la_codeerror']);
			$this -> view -> assign('URL_TIME',URL_TIME);
			$this -> view -> assign('get_url',BASE_WEBURL."/?security.html");
			$this -> view -> display('suggestion.tpl');
		}
		
		

	}
	
}

$Security = new Security();
if($GLOBALS['Webur'] -> getval["type"] == 'search')
{
	$Security -> search();
}else{
	$Security -> infolist();
}

?>