This repository has been archived by the owner on Jun 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slm_install.php
86 lines (86 loc) · 3.22 KB
/
slm_install.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
83
84
85
86
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Instalacja SLM</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
if($_POST['setprefix'] == 1) {
$prefixfile=fopen("slm_prefix.php","w");
flock($prefixfile, LOCK_EX);
fputs($prefixfile, '<?php'."\n");
fputs($prefixfile, '$prefix="'.$_POST['prefix'].'";'."\n");
fputs($prefixfile, '?>');
flock($prefixfile, LOCK_UN);
fclose($prefixfile);
if(file_exists("slm_prefix.php")) {
echo("Prefiks został zapisany pomyślnie!<br />");
} else {
echo("Nie udało się zapisać pliku z prefiksem! Sprawdź uprawnienia katalogu i spróbuj ponownie!<br />");
}
}
if(file_exists("slm_prefix.php")) {
if($_POST['step'] == "end") {
if($_POST['adminpass'] == $_POST['adminpchk']) {
$path="slm_users/".$_POST['adminname'].".php";
$f=fopen($path, 'w');
flock($f, LOCK_EX);
fputs($f, '<?php'."\n");
fputs($f, '$pass="'.$_POST['adminpass'].'";'."\n");
fputs($f, '$type="admin";'."\n");
fputs($f, '?>');
flock($f, LOCK_UN);
fclose($f);
echo("Instalacja zakończona pomyślnie!");
$step="none";
} else {
echo("Hasła się nie zgadzają!");
$step="setadmin";
}
} else if($_POST['step'] == "setadmin" OR $step == "setadmin") {
mkdir("slm_users");
mkdir("slm_bans");
?>
<h1>Tworzenie konta administratora</h1><br />
Skrypt utworzy teraz konto administratora.<br /><br />
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
Nazwa użytkownika: <input type="text" name="adminname" value="admin" /><br />
Hasło: <input type="password" name="adminpass" /><br />
Powtórz hasło: <input type="password" name="adminpchk" /><br />
<input type="hidden" name="step" value="end" />
<input type="submit" value="Stwórz i zakończ" />
</form>
<?php
} else if($_POST['step'] == "setfolders") {
?>
<h1>Tworzenie folderów danych</h1><br />
Skrypt utworzy teraz foldery dla danych SLM - "slm_users" i "slm_bans". Kliknij przycisk "Dalej".<br />
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="step" value="setadmin" />
<input type="submit" value="Dalej" />
</form>
<?php
} else {
?>
<h1>Instalacja SLM</h1><br />
Witaj w skrypcie instalacyjnym Phitherek_' s SLM. Zanim rozpoczniesz, upewnij się, że folder, w którym umieściłeś SLM, ma uprawnienia do zapisu dla wszystkich, najlepiej 777 (rwxrwxrwx). Jeżeli jesteś tego pewien, kliknij przycisk "Dalej".<br />
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="step" value="setfolders" />
<input type="submit" value="Dalej" />
</form>
<?php
}
} else {
echo("Ze względów bezpieczeństwa wymagane jest podanie prefiksu dla tej instalacji SLM. NIGDY nie instaluj dwóch systemów z tym samym prefiksem! Jeżeli jest to twoja pierwsza i jedyna instalacja SLM, zaleca się pozostawienie domyślnego prefiksu. Prefiks zostanie zapisany nawet, jeżeli instalacja nie zostanie ukończona.<br />");
?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="text" name="prefix" value="slm_" /><br />
<input type="hidden" name="setprefix" value="1" />
<input type="submit" value="Ustaw prefiks i kontynuuj" />
</form>
<?php
}
?>
</body>
</html>