You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
880 B

2 months ago
<?php
/**
*
*/
2 months ago
include_once(dirname(dirname(__FILE__)) . "/library/publicBase.php");
2 months ago
class callback extends publicBase {
public function wxlogin() {
2 months ago
if (empty($this->get('code'))) $this->show_message('登录失败,请重新登录', 'goback');
2 months ago
$state = explode('-', $this->get('state'));
if ($state[0] == CALLBACK_KNOWLEDGE_LOGIN) {
$obj = new mManage();
$res = $obj->weixinLogin($this->get('code'), $this->get('state'));
if (!$res) $this->show_message($obj->getError(), 'goback');
session_start();
2 months ago
$_SESSION['nickname'] = $res['nickname'];
2 months ago
$_SESSION['openid'] = $res['openid'];
$_SESSION['token'] = $res['jwttoken'];
session_write_close();
2 months ago
header('Location:' . urldecode($state[1]));
2 months ago
exit;
}
exit;
}
}