This repository was archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathfunctions.php
More file actions
127 lines (106 loc) · 3.44 KB
/
functions.php
File metadata and controls
127 lines (106 loc) · 3.44 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
error_reporting(0);
function playerID($player)
{
if ($player->playerid != '' || $player->pid != '') {
if ($player->playerid == '') {
$pid = $player->pid;
return $pid;
}
$pid = $player->playerid;
return $pid;
}
}
function remove($value)
{
$value = replace('`', $value);
$value = replace('"[[', $value);
$value = replace(']]"', $value);
return $value;
}
function replace($string, $text)
{
return str_replace($string, '', $text);
}
function license($value, $staffPerms)
{
$val = remove($value);
$newVal = explode(',', $val);
if ($newVal[1] == 1) {
$display = explode('_', $newVal[0]);
$displayN = $display['2'];
if ($staffPerms['editPlayer'] == '1') {
echo "<button type='button' id=".$newVal[0]." class='license btn btn-success btn-sm' style='margin-bottom: 5px;' onClick='post1(this.id);'>".$displayN.'</button> ';
} else {
echo "<button type='button' id=".$newVal[0]." class='license btn btn-success btn-sm' style='margin-bottom: 5px;'>".$displayN.'</button> ';
}
} else {
if ($newVal[0] != '') {
$display = explode('_', $newVal[0]);
$displayN = $display['2'];
if ($staffPerms['editPlayer'] == '1') {
echo "<button type='button' id=".$newVal[0]." class='btn btn-danger btn-sm' style='margin-bottom: 5px;' onClick='post(this.id);'>".$displayN.'</button> ';
} else {
echo "<button type='button' id=".$newVal[0]." class='btn btn-danger btn-sm' style='margin-bottom: 5px;' >".$displayN.'</button> ';
}
}
}
}
function guid($max, $pid)
{
if ($max != 2147483647) {
$steamID = $pid;
$temp = '';
for ($i = 0; $i < 8; ++$i) {
$temp .= chr($steamID & 0xFF);
$steamID >>= 8;
}
$return = md5('BE'.$temp);
return $return;
}
$return = 'GUID can not be used with 32 bit php!';
return $return;
}
function logIt($admin, $log, $dbcon)
{
$logQ = "INSERT INTO log (user,action,level) VALUES ('$admin','$log',1)";
mysqli_query($dbcon, $logQ);
}
function filterTable($dbcon, $sqlget)
{
$sqldata = mysqli_query($dbcon, $sqlget);
return $sqldata;
}
function outputSelection($max, $column, $value, $uid)
{
++$max;
echo '<td>' ?>
<select class='form-control' onChange = "dbSave(this.value, '<?php echo $uid; ?>', '<?php echo $column; ?>', '<?php echo $value; ?>' )" />
<?php
for ($i = 0; $i < $max; ++$i) {
if ($value == $i) {
echo "<option selected = 'selected'>$i</option>";
} else {
echo "<option>$i</option>";
}
}
echo '</select></td>';
}
function logs($perms, $column, $pid, $user, $dbcon, $player, $val)
{
if ($perms == '1') {
if ($val != $player->$column) {
$message = 'Admin '.$user.' has changed '.utf8_encode($player->name).'('.$pid.')'.' '.$column.' from '.$player->$column.' to '.$val;
logIt($user, $message, $dbcon);
$return = $val;
return $return;
}
} else {
if ($val != $player->$column) {
$message = 'Admin '.$user.' tried to change '.utf8_encode($player->name).'('.$pid.')'.' '.$column.' from '.$player->$column.' to '.$val;
logIt($user, $message, $dbcon);
$return = $player->$column;
return $return;
}
}
}