Kaynağa Gözat

modify session end

stanley-king 9 yıl önce
ebeveyn
işleme
a1c2604402

+ 1 - 1
data/logic/buy.logic.php

@@ -5,7 +5,7 @@
  *
  *
  *
- * by abc  www.abc.com 开发
+ * by abc  www.abc.com 开发ls
  */
 defined('InShopNC') or exit('Access Invalid!');
 class buyLogic {

+ 24 - 5
helper/fcgi_server.php

@@ -24,6 +24,28 @@ class fcgi_server
         $name = basename($file);
         return in_array($name,$exfiles);
     }
+    private function parase_requri()
+    {
+        $method = strtolower(request_helper::method());
+        if($method == 'get') {
+            return;
+        }
+
+        $file = request_helper::req_uri();
+        $ops = explode("?",$file);
+        if(count($ops) == 2)
+        {
+            $squery = $ops[1];
+            $params = preg_split('/&|=/', $squery);
+
+            for ($i = 0; $i < count($params); ++$i) {
+                $key = $params[$i];
+                $val = $params[++$i];
+                $_GET[$key] = $val;
+                $_POST[$key] = $val;
+            }
+        }
+    }
 
     public function run_looper()
     {
@@ -34,16 +56,16 @@ class fcgi_server
         {
             ob_start();
             http_header::instance()->start();
-
             try
             {
                 Log::start_sql_log();
 
+                Log::record("req_uri = " . request_helper::req_uri(),Log::DEBUG);
+                $this->parase_requri();
                 init_request();
                 init_cookie($_SERVER['HTTP_COOKIE']);
                 session::instance()->start();
 
-                Log::record("req_uri = " . request_helper::req_uri(),Log::DEBUG);
                 $file = request_helper::script_file();
                 if(file_exists($file))
                 {
@@ -60,9 +82,6 @@ class fcgi_server
                     echo "no such file.";
                 }
             }
-            catch (TypeException $ex) {
-                mobileControl::outerr($ex->getCode(),$ex->getMessage());
-            }
             catch (Exception $ex) {
                 mobileControl::outerr($ex->getCode(),$ex->getMessage());
             }

+ 0 - 4
helper/http_header.php

@@ -322,10 +322,6 @@ function init_cookie($cookie)
 
     if($val == false) return false;
 
-    foreach($_COOKIE as $key => $val) {
-        unset($_COOKIE[$key]);
-    }
-
     if(count($match) == 2)
     {
         foreach($match[1] as $val)

+ 7 - 3
helper/session.php

@@ -59,9 +59,14 @@ class session
         foreach($_COOKIE as $key=>$value) {
             unset($_COOKIE[$key]);
         }
-        foreach($_SERVER as $key=>$value) {
-            unset($_SERVER[$key]);
+        foreach($_POST as $key => $value) {
+            unset($_POST[$key]);
         }
+        foreach($_GET as $key => $value) {
+            unset($_GET[$key]);
+        }
+
+        request_helper::clear_server();
     }
 
     public function destroy() {
@@ -70,7 +75,6 @@ class session
     }
 
     public function onOpen() {
-        //Log::record("onOpen",Log::DEBUG);
         return true;
     }
     public function onRead($rsid)

+ 2 - 2
mobile/control/app_update.php

@@ -27,8 +27,8 @@ class app_updateControl extends mobileHomeControl
         $ver_code = $_GET['ver_code'];
         $app_platform = $_GET['platform'];
 
-        if (isset($app_platform) && isset($ver_code)) {
-
+        if (isset($app_platform) && isset($ver_code))
+        {
             $ret = rcache(self::CACHE_KEY, self::CACHE_CHECK_VERSION_ID);
             if (empty($ret)) {
                 $model = Model();

+ 1 - 1
mobile/control/bonus.php

@@ -48,7 +48,7 @@ class bonusControl extends mbMemberControl
             $freeze_value = $pd_array['freeze_predeposit'];     // 当前预存款冻结
             // 获取使用列表
             $ret_array = $member->getPdOrderList($condition['user_id']);
-            joutput_data(array('total_value' => $total_value,'freeze_value' => $freeze_value,"ret_array" => $ret_array));
+            self::outsuccess(array('total_value' => $total_value,'freeze_value' => $freeze_value,"ret_array" => $ret_array));
         }
     }
 

+ 2 - 2
mobile/control/goods.php

@@ -697,7 +697,6 @@ class goodsControl extends mobileControl
     public function detailOp()
     {
         $commonid = 0;
-
         $goods_id = intval($_GET['goods_id']);
         if (empty($_GET['goods_id']) || $goods_id <= 0)
         {
@@ -709,7 +708,8 @@ class goodsControl extends mobileControl
             $commonid = intval($info['goods_commonid']);
         }
 
-        if ($commonid > 0) {
+        if ($commonid > 0)
+        {
             $items = Model()->table('goods_common')->field('goods_body')->where(array('goods_commonid' => $commonid))->select();
             if (!empty($items) && count($items) > 0) {
                 Tpl::output('goods_body', $items[0]['goods_body']);

+ 1 - 3
mobile/templates/default/task_home.php

@@ -9,11 +9,9 @@
 
 <?php
 
-echo '<form action="index.php" method="post">
+echo '<form action="index.php?act=task&op=add&type=html" method="post">
     <fieldset>
 	<legend>Add a Task</legend>
-	    <input name="act" value="task" hidden>
-	    <input name="op" value="add" hidden>
         <p>Task: <input name="task" type="text" size="60" maxlength="100" required></p>
         <p>Parent Task: <select name="parent_id"><option value="0">None</option>';
 

+ 53 - 36
request_helper.php

@@ -147,25 +147,20 @@ class request_helper
         return fcgi_getparam('HTTP_COOKIE');
     }
 
-    static public function fill_server()
-    {
-        $tm = gettimeofday();
-        $_SERVER[REQUEST_TIME_FLOAT] = doubleval($tm['sec']) + doubleval($tm['usec']) / 1000000;
-        $_SERVER[REQUEST_TIME] = intval($tm['sec']);
-
-        //'PHP_SELF','argv','argc','REQUEST_TIME','REQUEST_TIME_FLOAT','SCRIPT_NAME','PATH_TRANSLATED',
-        $fields = array(
-//            'SCRIPT_NAME', 'SCRIPT_FILENAME', 'FCGI_ROLE',
-//            'GATEWAY_INTERFACE',
-//            'SERVER_ADDR',
-//            'SERVER_NAME',
-//            'SERVER_SOFTWARE',
-//            'SERVER_PROTOCOL',
-//            'REQUEST_METHOD',
-//            'QUERY_STRING',
-//            'DOCUMENT_URI',
-//            'DOCUMENT_ROOT',
-
+    static public function SRV_PARAMS()
+    {
+        //            'PHP_SELF','argv','argc','REQUEST_TIME','REQUEST_TIME_FLOAT','SCRIPT_NAME','PATH_TRANSLATED',
+        //            'SCRIPT_NAME', 'SCRIPT_FILENAME', 'FCGI_ROLE',
+        //            'GATEWAY_INTERFACE',
+        //            'SERVER_ADDR',
+        //            'SERVER_NAME',
+        //            'SERVER_SOFTWARE',
+        //            'SERVER_PROTOCOL',
+        //            'REQUEST_METHOD',
+        //            'QUERY_STRING',
+        //            'DOCUMENT_URI',
+        //            'DOCUMENT_ROOT',
+        static $fields = array(
             "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET",
             "HTTP_ACCEPT_ENCODING",
             "HTTP_ACCEPT_LANGUAGE", "HTTP_AUTHORIZATION",
@@ -204,37 +199,59 @@ class request_helper
             'HTTP_CLIENT_VERSION',
             'ORIG_PATH_INFO');
 
+        return $fields;
+    }
+
+    static public function fill_server()
+    {
+        $tm = gettimeofday();
+        $_SERVER[REQUEST_TIME_FLOAT] = doubleval($tm['sec']) + doubleval($tm['usec']) / 1000000;
+        $_SERVER[REQUEST_TIME] = intval($tm['sec']);
+
+        $fields = self::SRV_PARAMS();
         foreach ($fields as $field)
         {
-            try {
-                unset($_SERVER[$field]);
-                $param = fcgi_getparam($field);
-                $_SERVER[$field] = $param;
-            } catch(Exception $e){
-                Log::record($e->getTraceAsString(),Log::ERR);
-            }
+            $param = fcgi_getparam($field);
+            $_SERVER[$field] = $param;
+
+//            try {
+//                $param = fcgi_getparam($field);
+//                $_SERVER[$field] = $param;
+//            } catch(Exception $e){
+//                Log::record($e->getTraceAsString(),Log::ERR);
+//            }
         }
     }
 
-    static public function fill_param()
+    static public function clear_server()
     {
-        foreach ($_GET as $key => $val) {
-            unset($_GET[$key]);
-        }
-
-        foreach ($_POST as $key => $val) {
-            unset($_POST[$key]);
+        $fields = self::SRV_PARAMS();
+        foreach ($fields as $field) {
+            unset($_SERVER[$field]);
         }
+    }
 
+    static public function fill_param()
+    {
         $method = strtolower(request_helper::method());
-        $_GET['act'] = 'index';
-        $_GET['op'] = 'index';
+
+        if(!array_key_exists('act',$_GET)) {
+            $_GET['act'] = 'index';
+        }
+        if(!array_key_exists('op',$_GET)) {
+            $_GET['op'] = 'index';
+        }
+        if(!array_key_exists('act',$_POST)) {
+            $_POST['act'] = 'index';
+        }
+        if(!array_key_exists('op',$_POST)) {
+            $_POST['op'] = 'index';
+        }
 
         if ($method == 'get') {
             $squery = request_helper::query_string();
         } else {
             $squery = request_helper::content();
-            Log::record($squery);
         }
 
         if ($squery == '') {

+ 20 - 0
run.php

@@ -3,6 +3,26 @@
 
 define('InShopNC',true);
 
+$file = "/mobile/index.php";
+$ops = explode("?",$file);
+
+$squery = $ops[1];
+$params = preg_split('/&|=/', $squery);
+
+for ($i = 0; $i < count($params); ++$i) {
+    $key = $params[$i];
+    $val = $params[++$i];
+    $_GET[$key] = $val;
+    $_POST[$key] = $val;
+}
+
+
+
+
+$ret = array('jsObj' => NULL,'jsArray' => array());
+unset($ret['xxx']);
+$ret = json_encode($ret);
+
 define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
 
 echo BASE_ROOT_PATH."\n";