-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgetrocketstop.php
More file actions
39 lines (28 loc) · 840 Bytes
/
getrocketstop.php
File metadata and controls
39 lines (28 loc) · 840 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
33
34
35
36
37
38
<?php
//Use same config as bot
require_once("config.php");
// Establish mysql connection.
$dbh = new PDO("mysql:host=" . QUEST_DB_HOST . ";dbname=" . QUEST_DB_NAME . ";charset=utf8mb4", QUEST_DB_USER, QUEST_DB_PASSWORD, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING);
$rows = array();
try {
$sql = "
SELECT *
FROM invasions
LEFT JOIN pokestops
ON invasions.pokestop_id = pokestops.id
WHERE invasions.end_time > UTC_TIMESTAMP()
";
$result = $dbh->query($sql);
while($stop = $result->fetch(PDO::FETCH_ASSOC)) {
$rows[] = $stop;
}
}
catch (PDOException $exception) {
error_log($exception->getMessage());
$dbh = null;
exit;
}
print json_encode($rows);
$dbh = null;
?>