-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdevInfo.php
More file actions
25 lines (21 loc) · 772 Bytes
/
devInfo.php
File metadata and controls
25 lines (21 loc) · 772 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
<?php
$getURL=$_GET['url'];
//connect to the database so we can check, edit, or insert data to our users table
$conn = new PDO("mysql:host={{HOSTNAME}};dbname={{DATABASE-NAME}}", {{USERNAME}}, "{{PASSWORD}}");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$ipAddress=$_SERVER['REMOTE_ADDR'];
$json = file_get_contents("http://ip-api.com/json/".$ipAddress);
$obj = json_decode($json);
$country=$obj->country;
$state=$obj->regionName;
$city=$obj->city;
$sql= $conn->prepare('SELECT * FROM webpagetest_results ORDER BY datetime DESC LIMIT 1');
$sql->bindParam(':url', $getURL);
$sql->execute();
$row=$sql->fetch();
$getResultsURL = $row['json'];
$newjson = file_get_contents($getResultsURL);
$newobj = json_decode($newjson);
echo $newjson;
exit;
?>