-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.php
executable file
·267 lines (227 loc) · 9.8 KB
/
settings.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<?php
/**************************************************************************
* 0xBB ~ Bullettin Board *
**************************************************************************
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* =========================================================================*
* Software: 0xBB
* Software version: 2.0
* Author: KinG-InFeT
* Copyleft: GNU General Public License
* =========================================================================*
* settings.php
***************************************************************************/
include "kernel.php";
show_header();
show_menu ();
list ($username, $password) = get_data ();
if (!login ($username, $password))
die (header('Location: login.php'));
if(level($username) == 'banned')
_err("<b>[ERROR] </b><br /><b><u>". $username ."</u></b> è stato BANNATO dal forum!");
csrf_attemp($_SERVER['HTTP_REFERER']);
?>
<div class = 'path' id = 'path'>
<table>
<?php if(empty($_GET['mode'])) {?>
<tr><td><b><a href = 'index.php'>Home Forum</a></b></td></tr>
<?php }else{ ?>
<tr><td><b><a href = 'settings.php'>Home CP</a></b></td></tr>
<?php }?>
</table>
</div>
<div class = 'settings'>
<?php
switch (@$_GET ['mode']) {
case 1:
@$old_pass = $_POST ['old_pass'];
@$new_pass1 = $_POST ['new_pass1'];
@$new_pass2 = $_POST ['new_pass2'];
if (($old_pass) && ($new_pass1) && ($new_pass1 == $new_pass2)) {
$old_pass = md5 ($old_pass);
$new_pass1 = md5 ($new_pass1);
$query = "SELECT password
FROM ". __PREFIX__ ."users
WHERE username = '". $username ."'";
$row = mysql_fetch_row (mysql_query ($query));
if ($row [0] == $old_pass) {
$query = "UPDATE ". __PREFIX__ ."users
SET password = '{$new_pass1}'
WHERE username = '". $username ."'";
mysql_query ($query);
setcookie ("0xBB_pass", $new_pass1);
print "<script>alert(\"Password cambiata con successo.\"); window.location=\"settings.php\";</script>";
}else
print "<div class=\"error_msg\">La vecchia password è ERRATA!<br /><a href='javascript: history.back();'>Torna Indietro</a></div>";
}else{
?>
<p><b>Cambia Password:</b><p>
<form method = 'POST' action = 'settings.php?mode=1'>
<table>
<tr><td>Vecchia password:</td><td><input name = 'old_pass' type = 'password'></td></tr>
<tr><td>Nuova password:</td><td><input name = 'new_pass1' type = 'password'></td></tr>
<tr><td>Nuova password (again):</td><td><input name = 'new_pass2' type = 'password'></td></tr>
<tr><td><input type = 'submit' value = 'Cambia'></td></tr>
</table>
</form>
<?php
}
break;
case 2:
$themes = scandir("themes/");
if (!empty($_GET['select'])) {
if (in_array ($_GET['select'], $themes)) {
mysql_query("UPDATE ". __PREFIX__ ."users
SET theme = '".clear($_GET['select'])."';");
print "<script>alert(\"Tema Aggiornato\"); window.location.href = 'settings.php?mode=2';</script>";
}else {
die ("<script>alert(\"Errore! Il tema non è stato trovato!\"); window.location.href = 'settings.php?mode=2';</script>");
}
}else{
print "<p><b>Cambia Tema:</b><p>\n<br /><br />";
foreach ($themes as $theme)
if ($theme != "." && $theme != "..")
print "\n". $theme ." <a href = 'settings.php?mode=2&select=".$theme."'>Seleziona</a><br />";
}
break;
case 3:
@$old_email = $_POST ['old_email'];
@$new_email1 = $_POST ['new_email1'];
@$new_email2 = $_POST ['new_email2'];
if (($old_email) && ($new_email1) && ($new_email1 == $new_email2)) {
if(!($old_email != $new_email1))
_err("<b>Errore!</b>L' E-Mail inserita deve essere diversa da quella nuova!");
if(!(check_email($new_email1)))
_err("<b>Errore!</b>L' E-Mail inserita non è valida!");
if(check_email_register($new_email1) == FALSE)
_err("<b>Errore!</b>L' E-Mail inserita è già utilizzata da un'altro utente!");
$query = "SELECT email FROM ". __PREFIX__ ."users WHERE username = '". $username ."'";
$row = mysql_fetch_row (mysql_query ($query));
if ($row [0] == $old_email) {
$query = "UPDATE ". __PREFIX__ ."users SET email = '". $new_email1 ."' WHERE username = '". $username ."'";
mysql_query ($query) or _err(mysql_error());
print "<script>alert(\"E-Mail aggiornata con successo.\"); window.location=\"settings.php\";</script>";
}else
_err("ERRORE! La vecchia E-Mail è errata!");
}else{
?>
<p><b>Cambia E-Mail:</b><p>
<form method = 'POST' action = 'settings.php?mode=3'>
<table>
<tr><td>Vecchia E-Mail</td><td><input name = 'old_email' type = 'text'></td></tr>
<tr><td>Nuova E-Mail:</td><td><input name = 'new_email1' type = 'text'></td></tr>
<tr><td>Nuova E-Mail (again):</td><td><input name = 'new_email2' type = 'text'></td></tr>
<tr><td><input type = 'submit' value = 'Cambia'></td></tr>
</table>
</form>
<?php
}
break;
case 4:
if(@$_GET['send'] == 1) {
if ($_POST ['new_web_site']) {
if(check_url($_POST ['new_web_site']) == FALSE)
die('<div class="error_msg">Il Sito Web inserito non è valido<br />
<a href=\'javascript:history.back()\'>Torna Indietro</a></div>');
$query = "UPDATE ". __PREFIX__ ."users SET web_site = '".$_POST['new_web_site']."' WHERE username = '". $username ."'";
mysql_query ($query) or _err(mysql_error());
print "<script>alert(\"Sito web aggiornato con successo!.\"); window.location=\"settings.php\";</script>";
}else{
mysql_query("UPDATE ". __PREFIX__ ."users SET web_site = '' WHERE username = '". $username ."'");
print "<script>alert(\"Sito web eliminato con successo!.\"); window.location=\"settings.php\";</script>";
}
}else{
$web_site = mysql_fetch_row(mysql_query("SELECT web_site FROM ". __PREFIX__ ."users WHERE username = '". $username ."'"));
?>
<p><b>Aggiorna Sito Web:</b><p>
<form method = 'POST' action = 'settings.php?mode=4&send=1'>
<table>
<tr><td>* Nuovo Sito Web: </td><td> <input name = 'new_web_site' type = 'text' value="<?php print $web_site[0]; ?>" size="50"></td></tr>
<tr><td><input type = 'submit' value = 'Aggiorna'></td></tr>
</table>
<br />
* Svuotare il campo per eliminare il tuo Sito web
</form>
<?php
}
break;
case 5:
if(@$_GET['send'] == 1) {
if (!empty($_POST ['new_msn'])) {
if(check_email($_POST ['new_msn']) == FALSE)
die('<div class="error_msg">Il contatto MsN inserito non è valido<br />
<a href=\'javascript:history.back()\'>Torna Indietro</a></div>');
$query = "UPDATE ". __PREFIX__ ."users SET web_site = '".$_POST['new_web_site']."' WHERE username = '". $username ."'";
mysql_query ($query) or _err(mysql_error());
print "<script>alert(\"Contatto MsN aggiornato con successo!.\"); window.location=\"settings.php\";</script>";
}else{
mysql_query("UPDATE ". __PREFIX__ ."users SET msn = '' WHERE username = '". $username ."'");
print "<script>alert(\"Contatto MsN eliminato con successo!.\"); window.location=\"settings.php\";</script>";
}
}else{
$msn = mysql_fetch_row(mysql_query("SELECT msn FROM ". __PREFIX__ ."users WHERE username = '". $username ."'"));
?>
<p><b>Aggiorna Contatto MsN:</b><p>
<form method = 'POST' action = 'settings.php?mode=5&send=1'>
<table>
<tr><td>* Nuovo contatto MsN: </td><td><input name = 'new_msn' type = 'text' value="<?php print $msn[0]; ?>" size="50"></td></tr>
<tr><td><input type = 'submit' value = 'Aggiorna'></td></tr>
</table>
<br />
* Svuotare il campo per eliminare il tuo contatto MsN
</form>
<?php
}
break;
case 6:
@$new_firma = clear($_POST ['new_firma']);
if ($new_firma) {
$query = "UPDATE ". __PREFIX__ ."users SET firma = '{$new_firma}' WHERE username = '". $username ."'";
mysql_query ($query) or _err(mysql_error());
print "<script>alert(\"Firma Aggiornata!\"); window.location=\"settings.php\";</script>";
}else{
$firma = mysql_fetch_row(mysql_query("SELECT firma FROM ". __PREFIX__ ."users WHERE username = '". $username ."'"));
?>
<p><b>Cambia Firma:</b><p>
<form method = 'POST' action = 'settings.php?mode=6'>
Firma<br />
* NO HTML! Solo BBcode!
<br />
<textarea name = 'new_firma' cols="90" rows="13"><?php print htmlspecialchars($firma[0]); ?></textarea>
<br />
<input type = 'submit' value = 'Aggiorna'>
</form>
<?php
}
break;
default:
?>
<p><b>Pannello di controllo Utente</b><p>
<a href = 'settings.php?mode=1'>-> Cambia Password</a><br />
<a href = 'settings.php?mode=3'>-> Cambia E-Mail</a><br />
<a href = 'settings.php?mode=4'>-> Cambia Sito Web</a><br />
<a href = 'settings.php?mode=5'>-> Cambia Contatto MsN</a><br />
<a href = 'settings.php?mode=2'>-> Cambia Tema</a><br />
<a href = 'settings.php?mode=6'>-> Cambia Firma</a>
<?php
break;
}
?>
</div>
</div>
<?php
footer();
?>
</body>
</html>