www.gusucode.com > ShopEx481 & PHPWind 整合版码程序 > passport_client.php

    <?PHP
    include_once('config/config.php');
    include_once(CORE_DIR.'/kernel.php');
    include_once(CORE_DIR.'/include/shopCore.php');
    class phpwindCore extends kernel{
        function clientAction(){
            $passport=$this->loadModel('member/passport');
            $obj=$passport->function_judge('ClientUserAction');
            $this->InitGP(array('action','userdb','forward','verify'));
            if ($obj){
                $clientsign=md5($GLOBALS['action'].$GLOBALS['userdb'].$GLOBALS['forward'].$obj->_config['PrivateKey']);
                if ($clientsign==$GLOBALS['verify']){
                     $obj->ClientUserAction($GLOBALS['action'],$GLOBALS['userdb'],$GLOBALS['forward']);
                }
                else{
                    echo "安全检验失败,请检查通行证设置是否正确!";
                }
            }
            else{
                echo "请查看PhpWind论坛V6.3.2整合是否开启!!";
            }
        }
        function setCookie($name,$value,$expire=false,$path=null){
            if(!$this->_cookiePath){
                $cookiePath = $this->getConf('system.cookie.path');
                $cookieLife = $this->getConf('system.cookie.life');
                $this->_cookiePath = $cookiePath?$cookiePath:substr(PHP_SELF, 0, strrpos(PHP_SELF, '/'));
                $this->_cookieLife = $cookieLife;
            }
            $this->_cookieLife = ($this->_cookieLife>0)?$this->_cookieLife:315360000;
            setCookie(COOKIE_PFIX.'['.$name.']',$value,($expire===false)?(time()+$this->_cookieLife):$expire,$this->_cookiePath);
            $_COOKIE[$name] = $value;
	    } 
        function getConf($key){
		    $this->checkExpries(DB_PREFIX.'SETTINGS');
		    return parent::getConf($key);
	    }
        function InitGP($keys,$method=null,$cv=null){
           !is_array($keys) && $keys = array($keys);
           foreach ($keys as $k) {
               if ($method!='P' && isset($_GET[$k])) {
                   $GLOBALS[$k] = $_GET[$k];
               } elseif ($method!='G' && isset($_POST[$k])) {
                   $GLOBALS[$k] = $_POST[$k];
               }
               isset($GLOBALS[$k]) && !empty($cv) && $GLOBALS[$k] = $this->value_cv($GLOBALS[$k],$cv);
           }
        }
        function value_cv($value,$cv=null){
            if (empty($cv)) {
                return $value;
            } elseif ($cv=='int') {
                return (int)$value;
            } elseif ($cv=='array') {
                return is_array($value) ? $value : '';
            }
            return $this->Char_cv($value);
        }
        function Char_cv($msg,$isurl=null){
            $msg = preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/','',$msg);
            $msg = str_replace(array("\0","%00","\r"),'',$msg);
            empty($isurl) && $msg = preg_replace("/&(?!(#[0-9]+|[a-z]+);)/si",'&amp;',$msg);
            $msg = str_replace(array("%3C",'<'),'&lt;',$msg);
            $msg = str_replace(array("%3E",'>'),'&gt;',$msg);
            $msg = str_replace(array('"',"'","\t",'  '),array('&quot;','&#39;','    ','&nbsp;&nbsp;'),$msg);
            return $msg;
        }
        /*
        function &_frontend(){
        } */
    }
    $pw = new phpwindCore();
    $pw->clientAction();
?>