-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.php
More file actions
63 lines (55 loc) · 1.99 KB
/
main.php
File metadata and controls
63 lines (55 loc) · 1.99 KB
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
<?php
require __DIR__.'/../_ensure_https.php';
//Stop Direct Access to the File
//Works only in PHP 5.0 and Up
if (get_included_files()[0] == __FILE__) {exit("<h1>Access Denied</h1>");}
//Stop Including This File Twice
if (defined(strtoupper(basename(__FILE__,".php"))."_PHP")) {return True;}
define(strtoupper(basename(__FILE__,".php"))."_PHP", True);
//JSON input
//if ($_SERVER["REQUEST_METHOD"] == "POST" and $_SERVER["CONTENT_TYPE"] == "application/json") {
// $json = file_get_contents("php://input");
// $_POST = json_decode($json, True);
//}
// JSON input
// JSON input
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SERVER["CONTENT_TYPE"]) && strpos($_SERVER["CONTENT_TYPE"], "application/json") !== false) {
$json = file_get_contents("php://input");
$_POST = json_decode($json, true);
// If you want to handle JSON data in the same way as form data
foreach ($_POST as $key => $value) {
if (gettype($_POST[$key]) == "string") {
$_POST[$key] = htmlspecialchars($value);
}
}
} else {
// If it's not JSON, you can keep your existing code for handling form data
foreach ($_POST as $key => $value) {
if (gettype($_POST[$key]) == "string") {
$_POST[$key] = htmlspecialchars($value);
}
}
foreach ($_GET as $key => $value) {
if (gettype($_GET[$key]) == "string") {
$_GET[$key] = htmlspecialchars($value);
}
}
}
//Output JSON Error
function jsonError($err, $data = NULL)
{
if ($data) {
echo json_encode(["Error" => $err, "Data" => $data]);
exit();
}
echo json_encode(["Error" => $err]);
exit();
}
$isMobile = (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'android'));
//Constants
$socketurl = "BloxPVP.com";
$maxGameItems = 100;
$minimumTotalTaxItems = 4; // Set To Above maxGameItems * 2 to Disable
$minimumTotalTaxValue = 50;
$taxRecieverId = 1;
?>