-
Notifications
You must be signed in to change notification settings - Fork 1
/
fixusers.php
70 lines (63 loc) · 2.27 KB
/
fixusers.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
<?php
include("func.php");
if ($_GET["pwd"] == "oke") {
//Load users
echo("reading users...<br/>");
$users = array(array());
$files = array();
$handle = opendir("usersz/");
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo("reading file '" . $file . "'...<br/>");
$users[$file] = loadUser($file);
}
}
closedir($handle);
function cmpu($a, $b) {
$s = strcmp(strtolower($a["nick"]), strtolower($b["nick"]));
return ($s == 0 ? 0 : ($s < 0 ? -1 : 1));
}
uksort($users, "cmpu");
echo("<br/>");
foreach ($users as $user) {
if ($user["nick"] != "") {
echo("<b>" . $user["nick"] . "</b><br/>");
echo("elmaname: " . $user["elmaname"] . "<br/>");
echo("country: " . $user["country"] . "<br/>");
echo("team: " . $user["team"] . "<br/>");
echo("pwd: " . $user["pwd"] . "<br/>");
echo("registered: " . $user["registered"] . "<br/>");
echo("email: " . $user["email"] . "<br/>");
echo("theme: " . $user["theme"] . "<br/>");
echo("timezone: " . $user["timezone"] . "<br/>");
echo("timeformat: " . $user["timeformat"] . "<br/>");
echo("<br/><br/>");
}
}
echo("overwriting users...<br/>");
foreach ($users as $user) {
if ($user["nick"] != "") {
echo("writing to user " . $user["nick"] . "... ");
$fh = fopen("usersz/" . $user["nick"], "w");
fwrite($fh, $user["nick"] . "\n");
fwrite($fh, $user["elmaname"] . "\n");
fwrite($fh, $user["country"] . "\n");
fwrite($fh, $user["team"] . "\n");
fwrite($fh, $user["pwd"] . "\n");
fwrite($fh, $user["registered"] . "\n");
fwrite($fh, $user["email"] . "\n");
if ($user["theme"] == "") $user["theme"] = "Default";
fwrite($fh, $user["theme"] . "\n");
if ($user["timezone"] == "") $user["timezone"] = "0";
fwrite($fh, $user["timezone"] . "\n");
if ($user["timeformat"] == "") $user["timeformat"] = "m:s:i";
fwrite($fh, $user["timeformat"] . "\n");
fclose($fh);
echo("done!<br/>");
}
}
echo("<br/>suces!!");
} else {
echo("wrong pwd");
}
?>