Authored by hf

do fixes bug to qq login oauth bugs

@@ -60,7 +60,7 @@ class Oauth{ @@ -60,7 +60,7 @@ class Oauth{
60 //--------验证state防止CSRF攻击 60 //--------验证state防止CSRF攻击
61 // if($_GET['state'] != $state){ 61 // if($_GET['state'] != $state){
62 $state = Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__get('qqstate'); 62 $state = Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__get('qqstate');
63 - 63 + echo $state, '+++', $_GET['state'];
64 if ($_GET['state'] != $state) { 64 if ($_GET['state'] != $state) {
65 $this->error->showError("30001"); 65 $this->error->showError("30001");
66 } 66 }
1 <?php 1 <?php
  2 +
2 /* PHP SDK 3 /* PHP SDK
3 * @version 2.0.0 4 * @version 2.0.0
4 * @author connect@qq.com 5 * @author connect@qq.com
5 * @copyright © 2013, Tencent Corporation. All rights reserved. 6 * @copyright © 2013, Tencent Corporation. All rights reserved.
6 */ 7 */
7 8
8 -require_once(QC_CLASS_PATH.'ErrorCase.class.php'); 9 +require_once(QC_CLASS_PATH . 'ErrorCase.class.php');
  10 +
  11 +use Hood\Session;
  12 +
  13 +class Recorder
  14 +{
9 15
10 -class Recorder{  
11 private static $data; 16 private static $data;
12 private $inc; 17 private $inc;
13 private $error; 18 private $error;
14 19
15 - public function __construct(){ 20 + public function __construct()
  21 + {
16 $this->error = new ErrorCase(); 22 $this->error = new ErrorCase();
17 23
18 //-------读取配置文件 24 //-------读取配置文件
19 - $this->inc = require(QC_CLASS_PATH.'../Config.inc.php'); 25 + $this->inc = require(QC_CLASS_PATH . '../Config.inc.php');
20 26
21 - if(empty($this->inc)){ 27 + if (empty($this->inc)) {
22 $this->error->showError("20001"); 28 $this->error->showError("20001");
23 } 29 }
24 30
25 - if(empty($_SESSION['QC_userData'])){ 31 + $userData = Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__get('QC_userData');
  32 + if (empty($userData)) {
26 self::$data = array(); 33 self::$data = array();
27 - }else{  
28 - self::$data = $_SESSION['QC_userData']; 34 + } else {
  35 + self::$data = $userData;
29 } 36 }
  37 +// if(empty($_SESSION['QC_userData'])){
  38 +// self::$data = array();
  39 +// }else{
  40 +// self::$data = $_SESSION['QC_userData'];
  41 +// }
30 } 42 }
31 43
32 - public function write($name,$value){ 44 + public function write($name, $value)
  45 + {
33 self::$data[$name] = $value; 46 self::$data[$name] = $value;
34 } 47 }
35 48
36 - public function read($name){  
37 - if(empty(self::$data[$name])){ 49 + public function read($name)
  50 + {
  51 + if (empty(self::$data[$name])) {
38 return null; 52 return null;
39 - }else{ 53 + } else {
40 return self::$data[$name]; 54 return self::$data[$name];
41 } 55 }
42 } 56 }
43 57
44 - public function readInc($name){  
45 - if(empty($this->inc[$name])){ 58 + public function readInc($name)
  59 + {
  60 + if (empty($this->inc[$name])) {
46 return null; 61 return null;
47 - }else{ 62 + } else {
48 return $this->inc[$name]; 63 return $this->inc[$name];
49 } 64 }
50 } 65 }
51 66
52 - public function delete($name){ 67 + public function delete($name)
  68 + {
53 unset(self::$data[$name]); 69 unset(self::$data[$name]);
54 } 70 }
55 71
56 - function __destruct(){  
57 - $_SESSION['QC_userData'] = self::$data; 72 + function __destruct()
  73 + {
  74 + //$_SESSION['QC_userData'] = self::$data;
  75 + Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__set('QC_userData', self::$data);
58 } 76 }
  77 +
59 } 78 }