/
test.php
49 lines (46 loc) · 2.16 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
include_once('./common.php');
$xxx=curl_https("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx659ecc805f987bac&secret=da3bb34cc373fd0c4921b414c08eddef",true);
var_dump($xxx);
exit;
$xxx=file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx659ecc805f987bac&secret=da3bb34cc373fd0c4921b414c08eddef");
var_dump($xxx);
exit;
$h=getstr($_GET['h']);
$hash=substr($h,0,7);
$email= $_SGLOBAL['db']->getone("select email from ".tname("open_email_reg")." where hash='".$hash."' and addtime>'".($_SGLOBAL['timestamp']-(24*3600))."' and used=0");
include_once('./source/function_user.php');
if(is_email($email))
{
$query= $_SGLOBAL['db']->query("SELECT uid,username,state FROM ".tname("open_member")." where email='".$email."'");
$user=$_SGLOBAL['db']->fetch_array($query);
if($user){
updatetable(tname('open_member'),array('email_valid'=>1),array('uid'=>$user['uid']));
$backurl=$_SGLOBAL['db']->getone("select backurl from ".tname("open_email_reg")." where hash='".$hash."' and addtime>'".($_SGLOBAL['timestamp']-(24*3600))."'");
$backurl=empty($backurl)?'user.php':$backurl;
$setarr = array(
'uid' =>$user["uid"],
'username' => addslashes($user['username']),
'password' => md5($user["uid"]."|".$_SGLOBAL["timestamp"])//本地密码随机生成
);
//清理更新在线session
insertsession($setarr);
$cookietime=0;
$cookietime=3600 * 24 * 15;
//设置cookie
ssetcookie('auth', authcode($setarr["password"].' '.$setarr["uid"], 'ENCODE'),$cookietime);
ssetcookie('loginuser', $user['username'],$cookietime);
ssetcookie('_refer', '');
//标记这个登录码使用次数
$used= $_SGLOBAL['db']->getone("select used from ".tname("open_email_reg")." where email='".$email."' and hash='".$hash."' and addtime>'".($_SGLOBAL['timestamp']-(24*3600))."'");
$used=$used+1;
updatetable(tname('open_email_reg'),array('used'=>$used),array('email'=>$email));
//页面跳转
gourl($backurl);
exit();
}
}
showmessage('验证码错误或已经过期,请重新注册');
gourl('register.php?backurl='.urlencode($backurl));
exit();
?>