-
Notifications
You must be signed in to change notification settings - Fork 0
/
yanzheng.php
64 lines (54 loc) · 1.49 KB
/
yanzheng.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
// var_dump($_POST);
include_once('./functions.php');
include_once('./mysql.php');
// 接收数据
$auth = $_POST['auth'];
$tel = $_POST['tel'];
// dump($tel);
// die();
$code = $_POST['validate'];
$sign = '';
$data = [
'auth'=>$auth,
'tel'=>$tel,
'code'=>$code,
'sign'=>$sign
];
// 进行验证
$cookie_file = "./cookies/".$data['tel'].".txt";
$url = "https://event.bh3.com/bh3_2018spring_festival/identify.php";
// $data = "auth=".$auth."&sign=&code=".$validate."&tel=".$tel;
$response = https_request($url,true,$data,$cookie_file);
$response = json_decode($response);
// 验证失败
if($response->retcode !== 0){
dump('验证失败');
header('Location:register.php');
die();
}
// 保存本地cookie,方便下一次
$time = time()+60*60*24*30;
setcookie('phone',$tel,$time);
// 获取nickname
$url = "https://event.bh3.com/bh3_2018spring_festival/friends.php?auth=".$auth;
$response = https_request($url,false,null,$cookie_file);
$response = json_decode($response);
$nickname = $response->data->user->nickname;
// 存入tel auth nickname
$link = new Mysql();
$sql = "select * from member where tel=$tel";
$data = $link->query($sql);
if(!$data){
$sql = "insert into member (tel,auth,nickname) values ($tel,'$auth','$nickname')";
$res = $link->add($sql);
}
header('Location:login.php');
// $url = "https://event.bh3.com/bh3_2018spring_festival/friends.php";
// $data = [
// 'auth'=>$auth,
// 'sign'=>$sign
// ];
// $response = https_request($url,true,$data,true,$cookie_file);
// bangzhu($tel);
?>