/
index.php
113 lines (105 loc) · 3.06 KB
/
index.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
session_start();
?>
<html>
<?php
if(isset($_GET["token"]))header("Location: verify.php?token=".$_GET["token"]);
require(__DIR__."/config/config.php");
?>
<head>
<title>Third-Party Verification</title>
<meta charset="UTF-8">
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<center>
<h2>Third-Party Verification</h2>
<hr>
<script>
function statusChangeCallback(response) {
if (response.status === 'connected') {
document.getElementById('createbtn').disabled = '';
loginaction();
return true;
} else if (response.status === 'not_authorized') {
document.getElementById('status').innerHTML = 'Please log into this app.';
return false;
} else {
document.getElementById('status').innerHTML = 'Please log into Facebook.';
return false;
}
}
function checkLoginState() {
FB.getLoginStatus(function(response) {
if(statusChangeCallback(response))document.location = 'login.php';
else document.location = 'logout.php';
});
}
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $config['facebook']['app_id']; ?>',
cookie : true,
xfbml : true,
version : 'v2.5'
});
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function loginaction() {
FB.api('/me', function(response) {
document.getElementById('status').innerHTML = 'Login as ' + response.name + '.';
});
}
function logout(){
FB.logout(function(response) {
});
}
function deletetoken(token){
if(confirm("Delete?")) document.location = 'delete.php?token=' + token;
}
</script>
<div id="status"></div>
<div class="fb-login-button" data-max-rows="1" data-size="medium" data-show-faces="false" data-auto-logout-link="true" onlogin="checkLoginState();"></div>
<br><br>
<form action="create.php" method="POST">
<div class="g-recaptcha" data-sitekey="<?php echo $config['reCAPTCHA']['site_key']; ?>"></div>
<input id="createbtn" type="submit" value="Create Your Identity Verification" disabled>
</form>
<hr>
<?php
require(__DIR__.'/function/fblogin.php');
if($data = checklogin()){
?>
<table>
<tr><td>time</td><td>token</td><td>tool</td></tr>
<?php
require(__DIR__.'/function/SQL-function/sql.php');
$query = new query;
$query->dbname = 'xiplus';
$query->table = 'tpv';
$query->where = array(
array('fbid',$data['id'])
);
$query->order = array(
array('datetime')
);
$row = SELECT($query);
foreach ($row as $temp) {
echo '<tr><td>'.$temp['datetime'].'</td><td>'.$temp['token'].'</td><td><button onclick="deletetoken(\''.$temp['token'].'\')">delete</a></td></tr>';
}
?>
</table>
<?php
}
?>
</center>
</body>
</html>