-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_stats_v1.php
73 lines (68 loc) · 2.65 KB
/
main_stats_v1.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
<?php
require_once "../Webservice/db_functions.php";
require_once "../Webservice/send_mail.php";
require_once "../Webservice/utility.php";
function getIpAddress()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
return trim($ips[count($ips) - 1]);
}
else
return $_SERVER['REMOTE_ADDR'];
}
if (
isset($_GET["User_ID"]) && isset($_GET["Version"])
&& isset($_GET["Platform"]) && isset($_GET["OperatingSystem"])
&& isset($_GET["Language"]) && isset($_GET["Country"]) && isset($_GET["Resolution"])
&& isset($_GET["Start_Time"]) && isset($_GET["End_Time"])
)
{
if (
!empty($_GET["User_ID"]) && !empty($_GET["Version"])
&& !empty($_GET["Platform"]) && !empty($_GET["OperatingSystem"])
&& !empty($_GET["Language"]) && /*!empty($_GET["Country"]) && */ !empty($_GET["Resolution"])
&& !empty($_GET["Start_Time"]) && !empty($_GET["End_Time"])
)
{
$User_ID = $_GET["User_ID"];
$Version = $_GET["Version"];
$Platform = $_GET["Platform"];
$OperatingSystem = $_GET["OperatingSystem"];
$Language = $_GET["Language"];
if ($_GET["Country"] != "")
$Country = $_GET["Country"];
else
$Country = Localize::getLocationInfoByIp(getIpAddress());
$Resolution = $_GET["Resolution"];
$Start_Time = date ($_GET["Start_Time"]);
$End_Time = date ($_GET["End_Time"]);
DB_Insert::insert_main_stats($User_ID, $Version, $Platform, $OperatingSystem,
$Language, $Country, $Resolution, $Start_Time, $End_Time);
}
else
{
echo ("Required parameter empty");
$Message = "Required parameter empty:"."<br>";
foreach ($_GET as $Key => $Value)
{
$Message .= $Key." = '${Value}'";
$Message .= "<br>";
}
$Message .= "<br>"."<br>"."Server data:"."<br>";
foreach ($_SERVER as $Key => $Value)
{
$Message .= $Key." = '${Value}'";
$Message .= "<br>";
}
Send_Mail::OnError($Message);
}
}
else
{
echo ("Required parameter missing");
}
?>