-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckin.php
More file actions
32 lines (27 loc) · 826 Bytes
/
Copy pathcheckin.php
File metadata and controls
32 lines (27 loc) · 826 Bytes
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
<?php
function saveJSON($data){
file_put_contents('users.txt', base64_encode(serialize($data)));
}
function getJSON(){
if(file_exists('users.txt'))
return unserialize(base64_decode(file_get_contents('users.txt')));
else return NULL;
}
$secret = $_REQUEST['secret'];
if($secret == "GVO5Q32QJVUMESM4QOOXQG5FTS0WT5HCBTGBLLFAKI5JWM3T"){
$userData = getJSON();
$checkin = json_decode(stripslashes($_REQUEST['checkin']));
$userId = $checkin->user->id;
if(!isset($userData[$userId]))
$userData[$userId] = array();
if(isset($checkin->venue) && isset($checkin->venue->location)) {
$userData[$userId]['last-checkin'] = $checkin->venue->location;
saveJSON($userData);
}
else {
$userData[$userId]['last-checkin'] = NULL;
saveJSON($userData);
}
// echo json_encode($userData);
}
else echo "INVALID SECRET";