-
Notifications
You must be signed in to change notification settings - Fork 2
/
userAdminExecute.php
40 lines (35 loc) · 1.02 KB
/
userAdminExecute.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
<?php
include("common.php");
$dir=dir("db/Users/");
while ($filename = $dir->read())
{
if ($filename != "." && $filename != "..")
{
$filename = substr($filename,0,strlen($filename)-4);
$temp = new User(file_get_contents("db/Users/".$filename.".dat"));
if ($temp->getLevel() != $_POST[$filename][0] || ($temp->isBanned() == 'false' && $_POST[$filename][1] == "yes") || ($temp->isBanned() != 'false' && $_POST[$filename][1] != "yes"))
{
$fileC = file("db/Users/".$filename.".dat",FILE_IGNORE_NEW_LINES);
if ($_POST[$filename][0] == 1 || $_POST[$filename][0] == 2 || $_POST[$filename][0] == 3)
{
$fileC[6] = $_POST[$filename][0];
}
if ($_POST[$filename][1] == "yes")
{
$fileC[2] = "true";
}
else
{
$fileC[2] = "false";
}
$str = "";
foreach ($fileC as $line)
{
$str .= $line."\n";
}
file_put_contents("db/Users/".$filename.".dat", $str);
}
}
}
header("location: userAdmin.php");
?>