-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutility.php
executable file
·82 lines (69 loc) · 2.04 KB
/
utility.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
74
75
76
77
78
79
80
81
82
<?php
/**
* Pluto Attacxks
*
*
* @author Doug Park <doug@povingames.com>
* @copyright 2018 Povingames.com
* @license MIT License
*/
class debug_log {
public $debug_enabled = False;
public $debug_name = " ";
public $debug_label = " ------------------------------------";
public $debug_file = "debug_log-";
public function start($debug_name) {
$this->debug_enabled = True;
$this->debug_name .= $debug_name;
$this->debug_file .= $debug_name;
error_log(print_r("\n[" . date(c) . $this->debug_name . $this->debug_label . " - Start]\n", TRUE), 3, $this->debug_file);
}
public function cookie() {
if ($this->debug_enabled) {
error_log(print_r('$_COOKIE ', TRUE), 3, $this->debug_file);
error_log(print_r($_COOKIE, TRUE), 3, $this->debug_file);
}
}
public function request() {
if ($this->debug_enabled) {
error_log(print_r('$_REQUEST ', TRUE), 3, $this->debug_file);
error_log(print_r($_REQUEST, TRUE), 3, $this->debug_file);
}
}
public function session() {
if ($this->debug_enabled) {
error_log(print_r('$_SESSION ', TRUE), 3, $this->debug_file);
error_log(print_r($_SESSION, TRUE), 3, $this->debug_file);
}
}
public function end() {
if ($this->debug_enabled) {
$this->debug_enabled = False;
error_log(print_r("\n[" . date(c) . $this->debug_name . $this->debug_label . " - End]\n", TRUE), 3, $this->debug_file);
}
}
public function msg($label, $var) {
if ($this->debug_enabled) {
error_log(print_r("\n $label ", TRUE), 3, $this->debug_file);
error_log(print_r($var, TRUE), 3, $this->debug_file);
}
}
}
// Encode array as JSON response
class ArrayValue implements JsonSerializable {
public function __construct(array $array) {
$this->array = $array;
}
public function jsonSerialize() {
return $this->array;
}
}
// Encode string as JSON response
class StringValue implements JsonSerializable {
public function __construct($string) {
$this->string = (string) $string;
}
public function jsonSerialize() {
return $this->string;
}
}