Authored by hf

do fixes bug to qq login oauth bugs

... ... @@ -60,7 +60,7 @@ class Oauth{
//--------验证state防止CSRF攻击
// if($_GET['state'] != $state){
$state = Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__get('qqstate');
echo $state, '+++', $_GET['state'];
if ($_GET['state'] != $state) {
$this->error->showError("30001");
}
... ...
<?php
/* PHP SDK
* @version 2.0.0
* @author connect@qq.com
* @copyright © 2013, Tencent Corporation. All rights reserved.
*/
require_once(QC_CLASS_PATH.'ErrorCase.class.php');
require_once(QC_CLASS_PATH . 'ErrorCase.class.php');
use Hood\Session;
class Recorder
{
class Recorder{
private static $data;
private $inc;
private $error;
public function __construct(){
public function __construct()
{
$this->error = new ErrorCase();
//-------读取配置文件
$this->inc = require(QC_CLASS_PATH.'../Config.inc.php');
$this->inc = require(QC_CLASS_PATH . '../Config.inc.php');
if(empty($this->inc)){
if (empty($this->inc)) {
$this->error->showError("20001");
}
if(empty($_SESSION['QC_userData'])){
$userData = Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__get('QC_userData');
if (empty($userData)) {
self::$data = array();
}else{
self::$data = $_SESSION['QC_userData'];
} else {
self::$data = $userData;
}
// if(empty($_SESSION['QC_userData'])){
// self::$data = array();
// }else{
// self::$data = $_SESSION['QC_userData'];
// }
}
public function write($name,$value){
public function write($name, $value)
{
self::$data[$name] = $value;
}
public function read($name){
if(empty(self::$data[$name])){
public function read($name)
{
if (empty(self::$data[$name])) {
return null;
}else{
} else {
return self::$data[$name];
}
}
public function readInc($name){
if(empty($this->inc[$name])){
public function readInc($name)
{
if (empty($this->inc[$name])) {
return null;
}else{
} else {
return $this->inc[$name];
}
}
public function delete($name){
public function delete($name)
{
unset(self::$data[$name]);
}
function __destruct(){
$_SESSION['QC_userData'] = self::$data;
function __destruct()
{
//$_SESSION['QC_userData'] = self::$data;
Session::start('yohobuy_qq_session', null, 'yohobuy.com')->__set('QC_userData', self::$data);
}
}
... ...