1 |
<?PHP |
2 |
|
3 |
###################################################################### |
4 |
# PHP-NUKE: Web Portal System |
5 |
# =========================== |
6 |
# |
7 |
# Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve) |
8 |
# http://www.ncc.org.ve/php-nuke.php |
9 |
# |
10 |
# This modules is to manage all registered user's options |
11 |
# |
12 |
# This program is free software. You can redistribute it and/or modify |
13 |
# it under the terms of the GNU General Public License as published by |
14 |
# the Free Software Foundation; either version 2 of the License. |
15 |
###################################################################### |
16 |
|
17 |
if(!isset($mainfile)) { include("mainfile.php"); } |
18 |
|
19 |
function nav() { |
20 |
include("config.php"); |
21 |
?> |
22 |
<center> |
23 |
<a href="user.php?op=edituser"><img src=<?php echo "$uimages"; ?>/edit.gif border=0></a> |
24 |
<a href="user.php?op=edithome"><img src=<?php echo "$uimages"; ?>/change.gif border=0></a> |
25 |
<a href="user.php?op=editcomm"><img src=<?php echo "$uimages"; ?>/conf_comments.gif border=0></a> |
26 |
<a href="user.php?op=chgtheme"><img src=<?php echo "$uimages"; ?>/theme.gif border=0></a> |
27 |
<a href="user.php?op=logout"><img src=<?php echo "$uimages"; ?>/exit.gif border=0></a><br><br> |
28 |
</center> |
29 |
<?php |
30 |
} |
31 |
|
32 |
function userCheck($uname, $email) { |
33 |
global $stop; |
34 |
if ((!$email) || ($email=="") || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email))) $stop = "<center>".translate("ERROR: Invalid email")."</center><br>"; |
35 |
if (strrpos($uname,' ') > 0) $stop = "<center>".translate("ERROR: Email addresses do not contain spaces.")."</center>"; |
36 |
if ((!$uname) || ($uname=="") || (ereg("[^a-zA-Z0-9_-]",$uname))) $stop = "<center>".translate("ERROR: Invalid Nickname")."</center><br>"; |
37 |
if (strlen($uname) > 25) $stop = "<center>".translate("Nickname is too long. It must be less than 25 characters.")."</center>"; |
38 |
if (eregi("^((root)|(adm)|(linux)|(webmaster)|(admin)|(god)|(administrator)|(administrador)|(nobody)|(anonymous)|(anonimo)|(anĂ³nimo)|(operator))$",$uname)) $stop = "<center>".translate("ERROR: Name is reserved.").""; |
39 |
if (strrpos($uname,' ') > 0) $stop = "<center>".translate("There cannot be any spaces in the Nickname.")."</center>"; |
40 |
dbconnect(); |
41 |
if (mysql_num_rows(mysql_query("select uname from users where uname='$uname'")) > 0) $stop = "<center>".translate("ERROR: Nickname taken")."</center><br>"; |
42 |
if (mysql_num_rows(mysql_query("select email from users where email='$email'")) > 0) $stop = "<center>".translate("ERROR: Email address already registered")."</center><br>"; |
43 |
return($stop); |
44 |
} |
45 |
|
46 |
function makePass() { |
47 |
$makepass=""; |
48 |
$syllables="er,in,tia,wol,fe,pre,vet,jo,nes,al,len,son,cha,ir,ler,bo,ok,tio,nar,sim,ple,bla,ten,toe,cho,co,lat,spe,ak,er,po,co,lor,pen,cil,li,ght,wh,at,the,he,ck,is,mam,bo,no,fi,ve,any,way,pol,iti,cs,ra,dio,sou,rce,sea,rch,pa,per,com,bo,sp,eak,st,fi,rst,gr,oup,boy,ea,gle,tr,ail,bi,ble,brb,pri,dee,kay,en,be,se"; |
49 |
$syllable_array=explode(",", $syllables); |
50 |
srand((double)microtime()*1000000); |
51 |
for ($count=1;$count<=4;$count++) { |
52 |
if (rand()%10 == 1) { |
53 |
$makepass .= sprintf("%0.0f",(rand()%50)+1); |
54 |
} else { |
55 |
$makepass .= sprintf("%s",$syllable_array[rand()%62]); |
56 |
} |
57 |
} |
58 |
return($makepass); |
59 |
} |
60 |
|
61 |
function confirmNewUser($uname, $email) { |
62 |
global $stop, $EditedMessage; |
63 |
include("header.php"); |
64 |
filter_text($uname); |
65 |
$uname = $EditedMessage; |
66 |
userCheck($uname, $email); |
67 |
if (!$stop) { |
68 |
echo "Username: $uname<br>" |
69 |
."Email: $email<br>"; ?> |
70 |
<form action="user.php" method="post"> |
71 |
<input type="hidden" name="uname" value="<?PHP echo"$uname"; ?>"> |
72 |
<input type="hidden" name="email" value="<?PHP echo"$email"; ?>"> |
73 |
<br><br><input type=hidden name=op value=finish><input type="submit" value="<?php echo translate("Finish"); ?>"></form> |
74 |
<?PHP |
75 |
} else { |
76 |
echo "$stop"; |
77 |
} |
78 |
include("footer.php"); |
79 |
} |
80 |
|
81 |
function finishNewUser($uname, $email) { |
82 |
global $stop, $makepass, $EditedMessage; |
83 |
include("header.php"); |
84 |
dbconnect(); |
85 |
userCheck($uname, $email); |
86 |
if (!isset($stop)) { |
87 |
$makepass=makepass(); |
88 |
|
89 |
if(!$system) |
90 |
$cryptpass=crypt($makepass); |
91 |
else |
92 |
$cryptpass=$makepass; |
93 |
|
94 |
$result = mysql_query("insert into users values (NULL,'','$uname','$email','','','$cryptpass',10,'',0,0,0,'',0,'','','$commentlimit', '0')"); |
95 |
if(!$result) { |
96 |
echo mysql_errno(). ": ".mysql_error(). "<br>"; |
97 |
} else { |
98 |
$message = "".translate("Welcome to")." $sitename!\n\n".translate("You or someone else has used your email account")." ($email) ".translate("to register an account at")." $sitename. ".translate("The following is the member information:")."\n\n".translate("-Nickname: ")." $uname\n".translate("-Password: ")." $makepass"; |
99 |
$subject="".translate("User Password for")." $uname"; |
100 |
$from="$adminmail"; |
101 |
if ($system == 1) { |
102 |
echo "".translate("Your password is: ")."<b>$makepass</b><br>"; |
103 |
echo "<a href=\"user.php?op=login&uname=$uname&pass=$makepass\">Login</a> to change your info"; |
104 |
} else { |
105 |
mail($email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion()); |
106 |
echo "".translate("You are now registered. You should receive your password at the email account you provided.").""; |
107 |
} |
108 |
} |
109 |
} else { |
110 |
echo "$stop"; |
111 |
} |
112 |
include("footer.php"); |
113 |
} |
114 |
|
115 |
function userinfo($uname, $bypass=0) { |
116 |
global $user, $cookie; |
117 |
$result = mysql_query("select femail, url, bio from users where uname='$uname'"); |
118 |
$userinfo = mysql_fetch_array($result); |
119 |
if(!$bypass) cookiedecode($user); |
120 |
include("header.php"); |
121 |
if(($uname == $cookie[1]) || ($bypass==1)) { |
122 |
echo "<font face=Arial,Helvetica size=4><center>$uname, ".translate("Welcome to")." $sitename!<br><br>"; |
123 |
echo "<font size=3>".translate("This is your personal page")."<hr size=1 noshade>"; |
124 |
nav(); |
125 |
} |
126 |
if((mysql_num_rows($result)==1) && ($userinfo[url] || $userinfo[femail] || $userinfo[bio])) { |
127 |
if ($userinfo[url]) { echo "".translate("My HomePage:")." <a href=\"$userinfo[url]\">$userinfo[url]</a><br>\n"; } |
128 |
if ($userinfo[femail]) { echo "".translate("My E-Mail:")." <a href=\"mailto:$userinfo[femail]\">$userinfo[femail]</a><br>\n"; } |
129 |
if ($userinfo[bio]) { echo "<br><b>".translate("Extra Info:")." </b><br>$userinfo[bio]<br>\n"; } |
130 |
} else { |
131 |
echo "<center>".translate("There is no available info for")." $uname</center>"; |
132 |
} |
133 |
echo "<br><br><center>".translate("This web site uses")." <a href=/cookies.php>cookies</a></center>"; |
134 |
include("footer.php"); |
135 |
} |
136 |
|
137 |
function main($user) { |
138 |
global $stop; |
139 |
if(!isset($user)) { |
140 |
include("config.php"); |
141 |
include("header.php"); |
142 |
?> |
143 |
<?PHP if ($stop) echo "<center><blink><marquee><h3>".translate("Incorrect Login!")."</h3></marquee></blink></center>"; ?> |
144 |
<?php |
145 |
if ($user) { |
146 |
} else { |
147 |
?> |
148 |
<table cellpadding=1 cellspacing=0 border=0 bgcolor=000000 width="100%"><tr><td> |
149 |
<table cellpadding=8 cellspacing=0 border=0 bgcolor=FFFFFF width="100%"> |
150 |
<tr><td valign="top"> |
151 |
<form action="user.php" method="post"><font face=arial,helvetica> |
152 |
<b><?php echo translate("User Login"); ?></b><br><br> |
153 |
<?php echo translate("Nickname: "); ?><input type="text" name="uname" size=26 maxlength=25><br> |
154 |
<?php echo translate("Password: "); ?><input type="password" name="pass" size=21 maxlength=20><br> |
155 |
<input type=hidden name=op value="login"> |
156 |
<input type="submit" value="<?php echo translate("Login"); ?>"> |
157 |
</td</tr></table></td</tr></table></form> |
158 |
<br> |
159 |
<?php } ?> |
160 |
|
161 |
<table cellpadding=1 cellspacing=0 border=0 bgcolor=000000 width="100%"><tr><td> |
162 |
<table cellpadding=8 cellspacing=0 border=0 bgcolor=FFFFFF width="100%"> |
163 |
<tr><td valign="top"> |
164 |
<form action="user.php" method="post"><font face=arial,helvetica> |
165 |
<b><?php echo translate("New User:"); ?></b><br><br> |
166 |
<?php echo translate("Nickname: "); ?><input type="text" name="uname" size=26 maxlength=25><br> |
167 |
<?php echo translate("E-Mail: "); ?><input type="text" name="email" size=25 maxlength=60><br> |
168 |
<input type=hidden name=op value="new user"> |
169 |
<input type="submit" value="<?php echo translate("New User"); ?>"> |
170 |
</form> |
171 |
<font size=2><?php echo translate("(Password will be sent to the email address you enter.)"); ?><br><br> |
172 |
<font size=2><?php echo translate("Notice: Account preferences are cookie based."); ?> <a href="cookies.php"><?php echo translate("more info..."); ?></a></font><br> |
173 |
<?php echo translate("As a registered user you can:"); ?><br> |
174 |
<li> <?php echo translate("Post comments with your name"); ?> |
175 |
<li> <?php echo translate("Send news with your name"); ?> |
176 |
<li> <?php echo translate("Have a personal box in the Home"); ?> |
177 |
<li> <?php echo translate("Select how many news you want in Home"); ?> |
178 |
<li> <?php echo translate("Customize the comments"); ?> |
179 |
<li> <?php echo translate("Select different themes"); ?> |
180 |
<li> <?php echo translate("some other cool stuff..."); ?><br> |
181 |
<?php echo translate("Register Now! It's Free!"); ?><br> |
182 |
<?php echo translate("We don't sell/give to others your personal info."); ?> |
183 |
</td</tr></table></td</tr></table> |
184 |
<br><br> |
185 |
|
186 |
<table cellpadding=1 cellspacing=0 border=0 bgcolor=000000 width="100%"><tr><td> |
187 |
<table cellpadding=8 cellspacing=0 border=0 bgcolor=FFFFFF width="100%"> |
188 |
<tr><td valign="top"><font face=Arial,Helvetica> |
189 |
<b><?php echo translate("Lost your Password?"); ?></b><br><br> |
190 |
<font size=2> |
191 |
<?php echo translate("No problem. Just type your Nickname and click on send button."); ?><br> |
192 |
<?php echo translate("Confirmation Info"); ?><br> |
193 |
<form action="user.php" method="post"><font face=arial,helvetica> |
194 |
<?php echo translate("Nickname: "); ?><input type="text" name="uname" size=26 maxlength=25> |
195 |
<?php echo translate("Confirmation Code: "); ?><input type="text" name="code" size=5 maxlength=6><br> |
196 |
<input type=hidden name=op value=mailpasswd> |
197 |
<input type="submit" value="<?php echo translate("Send Password"); ?>"> |
198 |
</td></tr></table></td></tr></table></form> |
199 |
|
200 |
<?PHP |
201 |
include("footer.php"); |
202 |
} elseif(isset($user)) { |
203 |
global $cookie; |
204 |
cookiedecode($user); |
205 |
dbconnect(); |
206 |
userinfo($cookie[1]); |
207 |
} |
208 |
} |
209 |
|
210 |
function logout() { |
211 |
setcookie("user"); |
212 |
include("header.php"); |
213 |
?> |
214 |
<?php echo " |
215 |
<center><font face=arial,helvetica size=4><br><br> |
216 |
".translate("You are now logged out")." |
217 |
</center>"; ?> |
218 |
<?PHP |
219 |
include("footer.php"); |
220 |
} |
221 |
|
222 |
function mail_password($uname, $code) { |
223 |
include("config.php"); |
224 |
|
225 |
dbconnect(); |
226 |
$result = mysql_query("select email, pass from users where (uname='$uname')"); |
227 |
if(!$result) { |
228 |
echo "<center>".translate("Sorry, no corresponding user info was found")."</center>"; |
229 |
} else { |
230 |
$host_name = getenv("REMOTE_ADDR"); |
231 |
list($email, $pass) = mysql_fetch_row($result); |
232 |
|
233 |
$areyou = substr($pass, 0, 5); |
234 |
if ($areyou==$code) { |
235 |
|
236 |
$newpass=makepass(); |
237 |
$message = "".translate("The user account")." '$uname' ".translate("at")." $nuke_url ".translate("has this email associated with it.")." ".translate("A web user from")." $host_name ".translate("has just requested that password be sent.")."\n\n".translate("Your New Password is:")." $newpass\n\n ".translate("You can change it after you login at")." $nuke_url/user.php\n\n".translate("If you didn't ask for this, don't worry. You are seeing this message, not 'them'. If this was an error just login with your new password.").""; |
238 |
$subject="".translate("User Password for")." $uname"; |
239 |
mail($email, $subject, $message, "From: $adminmail\nX-Mailer: PHP/" . phpversion()); |
240 |
|
241 |
// Next step: add the new password to the database |
242 |
|
243 |
if(!$system) { |
244 |
$cryptpass=crypt($newpass); |
245 |
} else { |
246 |
$cryptpass=$newpass; |
247 |
} |
248 |
$query="update users set pass='$cryptpass' where uname='$uname'"; |
249 |
if(!mysql_query($query)) { |
250 |
echo "mail_password: could not update user entry. Contact the Administrator"; |
251 |
} |
252 |
|
253 |
$titlebar = "User password sent"; |
254 |
include ("header.php"); |
255 |
echo "<center>".translate("Password for")." $email ".translate("mailed.").""; |
256 |
include ("footer.php"); |
257 |
|
258 |
// If no Code, send it |
259 |
|
260 |
} else { |
261 |
|
262 |
$result = mysql_query("select email, pass from users where (uname='$uname')"); |
263 |
if(!$result) { |
264 |
echo "<center>".translate("Sorry, no corresponding user info was found")."</center>"; |
265 |
} else { |
266 |
$host_name = getenv("REMOTE_ADDR"); |
267 |
list($email, $pass) = mysql_fetch_row($result); |
268 |
$areyou = substr($pass, 0, 5); |
269 |
|
270 |
$message = "".translate("The user account")." '$uname' ".translate("at")." $nuke_url ".translate("has this email associated with it.")." ".translate("A web user from")." $host_name ".translate("has just requested a Confirmation Code to change the password.")."\n\n".translate("Your Confirmation Code is:")." $areyou \n\n".translate("With this code you can now assign a new password at")." $nuke_url/user.php\n".translate("If you didn't ask for this, don't worry. Just delete this Email.").""; |
271 |
$subject="".translate("Confirmation Code for")." $uname"; |
272 |
mail($email, $subject, $message, "From: $adminmail\nX-Mailer: PHP/" . phpversion()); |
273 |
|
274 |
include ("header.php"); |
275 |
echo "<center>".translate("Confirmation Code for")." $email ".translate("mailed.").""; |
276 |
include ("footer.php"); |
277 |
} |
278 |
} |
279 |
} |
280 |
} |
281 |
|
282 |
function docookie($setuid, $setuname, $setpass, $setstorynum, $setumode, $setuorder, $setthold, $setnoscore, $setublockon, $settheme, $setcommentmax) { |
283 |
$info = base64_encode("$setuid:$setuname:$setpass:$setstorynum:$setumode:$setuorder:$setthold:$setnoscore:$setublockon:$settheme:$setcommentmax"); |
284 |
setcookie("user","$info",time()+15552000); // 6 mo is 15552000 |
285 |
} |
286 |
|
287 |
function login($uname, $pass) { |
288 |
global $setinfo,$system; |
289 |
dbconnect(); |
290 |
$result = mysql_query("select pass, uid, storynum, umode, uorder, thold, noscore, ublockon, theme, commentmax from users where uname='$uname'"); |
291 |
if(mysql_num_rows($result)==1) { |
292 |
$setinfo = mysql_fetch_array($result); |
293 |
|
294 |
$dbpass=$setinfo[pass]; |
295 |
|
296 |
if(!$system) |
297 |
$pass=crypt($pass,substr($dbpass,0,2)); |
298 |
|
299 |
if (strcmp($dbpass,$pass)) { |
300 |
Header("Location: $nuke_url/user.php?stop=1"); |
301 |
return; |
302 |
} |
303 |
|
304 |
|
305 |
|
306 |
docookie($setinfo[uid], $uname, $pass, $setinfo[storynum], $setinfo[umode], $setinfo[uorder], $setinfo[thold], $setinfo[noscore], $setinfo[ublockon], $setinfo[theme], $setinfo[commentmax]); |
307 |
Header("Location: user.php?op=userinfo&bypass=1&uname=$uname"); |
308 |
} else { |
309 |
Header("Location: user.php?stop=1"); |
310 |
} |
311 |
} |
312 |
|
313 |
function infoCheck($uid, $email, $url) { |
314 |
global $stop; |
315 |
if ((!$email) || ($email=="") || (!ereg("[@]",$email)) || (!ereg("[.]",$email)) || (strlen($email) < 7) || (ereg("[^a-zA-Z0-9@.]",$email))) { $stop = "Invalid email<br>"; } |
316 |
if (($url) && ($url!="http://") && ((!ereg("[http://]",$url)) || (!ereg("[.]",$url)) || (strlen($url) < 12) || (ereg("[^a-zA-Z0-9~.:/]",$url)))) { $stop = "Invalid URL<br>"; } |
317 |
dbconnect(); |
318 |
list($test) = mysql_fetch_row(mysql_query("select email from users where (email='$email' and uid!=$uid)")); |
319 |
if ("$test"=="$email") $stop = "<center>".translate("ERROR: Email address already registered")."</center><br>"; |
320 |
return($stop); |
321 |
} |
322 |
|
323 |
function edituser() { |
324 |
global $user, $userinfo; |
325 |
include("header.php"); |
326 |
getusrinfo($user); |
327 |
nav(); |
328 |
?> |
329 |
<table cellpadding=8 border=0><tr><td> |
330 |
<form action="user.php" method="post"> |
331 |
<font face=Arial,Helvetica> |
332 |
<b><?php echo translate("Real Name"); ?></b> <?php echo translate("(optional)"); ?><br> |
333 |
<input type="text" name="name" value="<?PHP echo"$userinfo[name]"; ?>" size=30 maxlength=60><br> |
334 |
<b><?php echo translate("Real Email"); ?></b> <?php echo translate("(required)"); ?><br> |
335 |
<?php echo translate("(This Email will not be public but is required, will be used to send your password if you lost it)"); ?><br> |
336 |
<input type="text" name="email" value="<?PHP echo"$userinfo[email]"; ?>" size=30 maxlength=60><br> |
337 |
<b><?php echo translate("Fake Email"); ?></b> <?php echo translate("(optional)"); ?><br> |
338 |
<?php echo translate("(This Email will be public. Just type what you want, Spam proof)"); ?><br> |
339 |
<input type="text" name="femail" value="<?PHP echo"$userinfo[femail]"; ?>" size=30 maxlength=60><br> |
340 |
<b><?php echo translate("Your HomePage"); ?></b> <?php echo translate("(optional)"); ?><br> |
341 |
<input type="text" name="url" value="<?PHP echo"$userinfo[url]"; ?>" size=30 maxlength=100><br> |
342 |
<b><?php echo translate("Extra Info"); ?></b> <?php echo translate("(optional)"); ?><br> |
343 |
<?php echo translate("(255 characters max. Type what others can know about yourself)"); ?><br> |
344 |
<textarea wrap=virtual cols=50 rows=5 name=bio><?PHP echo"$userinfo[bio]"; ?></TEXTAREA> |
345 |
<br><br> |
346 |
<b><?php echo translate("Password"); ?></b> <?php echo translate("(type a new password twice to change it)"); ?><br> |
347 |
<input type="password" name="pass" size=10 maxlength=20> <input type="password" name="vpass" size=10 maxlength=20> |
348 |
<br><br> |
349 |
<input type="hidden" name="uname" value="<?PHP echo"$userinfo[uname]"; ?>"> |
350 |
<input type="hidden" name="uid" value="<?PHP echo"$userinfo[uid]"; ?>"> |
351 |
<input type="hidden" name="op" value="saveuser"> |
352 |
<input type="submit" value="<?php echo translate("Save Changes"); ?>"> |
353 |
</form></td></tr></table> |
354 |
<?PHP |
355 |
include("footer.php"); |
356 |
} |
357 |
|
358 |
function saveuser($uid, $name, $uname, $email, $femail, $url, $pass, $vpass, $bio) { |
359 |
global $user, $cookie, $userinfo, $EditedMessage,$system; |
360 |
if ((isset($pass)) && ("$pass" != "$vpass")) { |
361 |
echo "<center>".translate("Both passwords are different. They need to be identical.")."</center>"; |
362 |
} elseif (($pass != "") && (strlen($pass) < $minpass)) { |
363 |
echo "<center>".translate("Sorry, your password must be at least")." <b>$minpass</b> ".translate("characters long")."</center>"; |
364 |
} else { |
365 |
if ($bio) { filter_text($bio); $bio = $EditedMessage; $bio = FixQuotes($bio); } |
366 |
if ($pass != "") { |
367 |
dbconnect(); |
368 |
cookiedecode($user); |
369 |
mysql_query("LOCK TABLES users WRITE"); |
370 |
|
371 |
if(!$system) |
372 |
$pass=crypt($pass); |
373 |
mysql_query("update users set name='$name', email='$email', femail='$femail', url='$url', pass='$pass', bio='$bio' where uid='$uid'"); |
374 |
$result = mysql_query("select uid, uname, pass, storynum, umode, uorder, thold, noscore, ublockon, theme from users where uname='$uname' and pass='$pass'"); |
375 |
if(mysql_num_rows($result)==1) { |
376 |
$userinfo = mysql_fetch_array($result); |
377 |
docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme],$userinfo[commentmax]); |
378 |
} else { |
379 |
echo "<center>".translate("Something screwed up... don't you hate that?")."</center><br>"; |
380 |
} |
381 |
mysql_query("UNLOCK TABLES"); |
382 |
} else { |
383 |
dbconnect(); |
384 |
mysql_query("update users set name='$name', email='$email', femail='$femail', url='$url', bio='$bio' where uid=$uid"); |
385 |
} |
386 |
Header("Location: user.php?"); // question is wierd bugfix |
387 |
} |
388 |
} |
389 |
|
390 |
function edithome() { |
391 |
global $user, $userinfo; |
392 |
include ("header.php"); |
393 |
getusrinfo($user); |
394 |
nav(); |
395 |
if($userinfo[theme]=="") $userinfo[theme] = "Default"; |
396 |
?> |
397 |
<table cellpadding=8 border=0><tr><td> |
398 |
<form action="user.php" method="post"> |
399 |
<font face=Arial,Helvetica> |
400 |
<b><?php echo translate("News number in the Home"); ?></b> (max: 127)<br> |
401 |
<input type="text" name="storynum" size=3 maxlength=3 value=<?PHP echo"$userinfo[storynum]"; ?>> |
402 |
<br><br> |
403 |
<B><?php echo translate("Activate Personal Menu"); ?></B> <INPUT type=checkbox name=ublockon <?PHP if ($userinfo[ublockon]==1) { echo "checked"; } ?>> |
404 |
<br><?php echo translate("(Check this option and the following text will appear in the Home)"); ?> |
405 |
<br><?php echo translate("(You can use HTML code to put links, for example)"); ?><br> |
406 |
<textarea cols=55 rows=5 name=ublock><?PHP echo"$userinfo[ublock]"; ?></textarea> |
407 |
<br><br> |
408 |
<input type="hidden" name="theme" value="<?PHP echo"$userinfo[theme]"; ?>"> |
409 |
<input type="hidden" name="uname" value="<?PHP echo"$userinfo[uname]"; ?>"> |
410 |
<input type="hidden" name="uid" value="<?PHP echo"$userinfo[uid]"; ?>"> |
411 |
<input type="hidden" name="op" value="savehome"> |
412 |
<input type="submit" value="<?php echo translate("Save Changes!"); ?>"> |
413 |
</form></td></tr></table> |
414 |
<?PHP |
415 |
include ("footer.php"); |
416 |
} |
417 |
|
418 |
function chgtheme() { |
419 |
global $user, $userinfo; |
420 |
include ("header.php"); |
421 |
getusrinfo($user); |
422 |
nav(); |
423 |
?> |
424 |
<center> |
425 |
<form action="user.php" method="post"> |
426 |
|
427 |
<font face=Arial,Helvetica><b><?php echo translate("Select One Theme"); ?></b><br> |
428 |
<select name=theme> |
429 |
<?php |
430 |
include("themes/list.php"); |
431 |
$themelist = explode(" ", $themelist); |
432 |
for ($i=0; $i < sizeof($themelist); $i++) { |
433 |
if($themelist[$i]!="") { |
434 |
echo "<option value=\"$themelist[$i]\" "; |
435 |
if((($userinfo[theme]=="") && ($themelist[$i]=="Default")) || ($userinfo[theme]==$themelist[$i])) echo "selected"; |
436 |
echo ">$themelist[$i]\n"; |
437 |
} |
438 |
} |
439 |
if($userinfo[theme]=="") $userinfo[theme] = "Default"; |
440 |
?> |
441 |
</select> |
442 |
<br><font face=Arial,Helvetica> |
443 |
<?php echo " |
444 |
".translate("This option will change the look for the whole site.")."<br> |
445 |
".translate("The changes will be valid only to you.")."<br> |
446 |
".translate("Each user can view the site with different theme.")."<br> |
447 |
"; ?> |
448 |
<br> |
449 |
|
450 |
<input type="hidden" name="storynum" value="<?PHP echo"$userinfo[storynum]"; ?>"> |
451 |
<input type="hidden" name="ublockon" value="<?PHP echo"$userinfo[ublockon]"; ?>"> |
452 |
<input type="hidden" name="ublock" value="<?PHP echo"$userinfo[ublock]"; ?>"> |
453 |
|
454 |
<input type="hidden" name="uname" value="<?PHP echo"$userinfo[uname]"; ?>"> |
455 |
<input type="hidden" name="uid" value="<?PHP echo"$userinfo[uid]"; ?>"> |
456 |
<input type="hidden" name="op" value="savetheme"> |
457 |
<input type="submit" value="<?php echo translate("Save Changes!"); ?>"> |
458 |
</form> |
459 |
<?PHP |
460 |
include ("footer.php"); |
461 |
} |
462 |
|
463 |
|
464 |
function savehome($uid, $uname, $theme, $storynum, $ublockon, $ublock) { |
465 |
global $user, $userinfo; |
466 |
dbconnect(); |
467 |
if(isset($ublockon)) $ublockon=1; else $ublockon=0; |
468 |
$ublock = FixQuotes($ublock); |
469 |
mysql_query("LOCK TABLES users WRITE"); |
470 |
mysql_query("update users set storynum='$storynum', ublockon='$ublockon', ublock='$ublock' where uid=$uid"); |
471 |
getusrinfo($user); |
472 |
mysql_query("UNLOCK TABLES"); |
473 |
docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme],$userinfo[commentmax]); |
474 |
Header("Location: user.php?theme=$theme"); |
475 |
} |
476 |
|
477 |
function savetheme($uid, $theme) { |
478 |
global $user, $userinfo; |
479 |
dbconnect(); |
480 |
mysql_query("update users set theme='$theme' where uid=$uid"); |
481 |
getusrinfo($user); |
482 |
docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme],$userinfo[commentmax]); |
483 |
Header("Location: user.php?theme=$theme"); |
484 |
} |
485 |
|
486 |
function editcomm() { |
487 |
global $user, $userinfo; |
488 |
include ("header.php"); |
489 |
getusrinfo($user); |
490 |
nav(); |
491 |
?> |
492 |
<table cellpadding=8 border=0><tr><td> |
493 |
<form action="user.php" method="post"><font face=Arial,Helvetica> |
494 |
<b><?php echo translate("Display Mode"); ?></b> |
495 |
<select name=umode> |
496 |
<option value="nocomments" <?PHP if ($userinfo[umode] == 'nocomments') { echo "selected"; } ?>><?php echo translate("No Comments"); ?> |
497 |
<option value="nested" <?PHP if ($userinfo[umode] == 'nested') { echo "selected"; } ?>><?php echo translate("Nested"); ?> |
498 |
<option value="flat" <?PHP if ($userinfo[umode] == 'flat') { echo "selected"; } ?>><?php echo translate("Flat"); ?> |
499 |
<option value="threaded" <?PHP if (!isset($userinfo[umode]) || ($userinfo[umode]=="") || $userinfo[umode]=='threaded') { echo "selected"; } ?>><?php echo translate("Threaded"); ?> |
500 |
</select> |
501 |
<br><br> |
502 |
<b><?php echo translate("Sort Order"); ?></b> |
503 |
<select name=uorder> |
504 |
<option value="0" <?PHP if (!$userinfo[uorder]) { echo "selected"; } ?>><?php echo translate("Oldest First"); ?> |
505 |
<option value="1" <?PHP if ($userinfo[uorder]==1) { echo "selected"; } ?>><?php echo translate("Newest First"); ?> |
506 |
<option value="2" <?PHP if ($userinfo[uorder]==2) { echo "selected"; } ?>><?php echo translate("Highest Scores First"); ?> |
507 |
</select> |
508 |
<br><br> |
509 |
<b><?php echo translate("Threshold"); ?></b> |
510 |
<?php echo translate("Comments scored less than this setting will be ignored."); ?><br> |
511 |
<select name=thold> |
512 |
<option value="-1" <?PHP if ($userinfo[thold]==-1) { echo "selected"; } ?>>-1: <?php echo translate("Uncut and Raw"); ?> |
513 |
<option value="0" <?PHP if ($userinfo[thold]==0) { echo "selected"; } ?>>0: <?php echo translate("Almost Everything"); ?> |
514 |
<option value="1" <?PHP if ($userinfo[thold]==1) { echo "selected"; } ?>>1: <?php echo translate("Filter Most Anon"); ?> |
515 |
<option value="2" <?PHP if ($userinfo[thold]==2) { echo "selected"; } ?>>2: <?php echo translate("Score"); ?> +2 |
516 |
<option value="3" <?PHP if ($userinfo[thold]==3) { echo "selected"; } ?>>3: <?php echo translate("Score"); ?> +3 |
517 |
<option value="4" <?PHP if ($userinfo[thold]==4) { echo "selected"; } ?>>4: <?php echo translate("Score"); ?> +4 |
518 |
<option value="5" <?PHP if ($userinfo[thold]==5) { echo "selected"; } ?>>5: <?php echo translate("Score"); ?> +5 |
519 |
</select><br> |
520 |
<?php echo translate("Anonymous posts start at 0, logged in posts start at 1. Moderators add and subtract points."); ?> |
521 |
<br><br> |
522 |
<INPUT type=checkbox name=noscore <?PHP if ($userinfo[noscore]==1) { echo "checked"; } ?>><B> <?php echo translate("Do Not Display Scores"); ?></B> <?php echo translate("(Hides score: They still apply, you just don't see them.)"); ?> |
523 |
<br><br> |
524 |
<b><?php echo translate("Max Comment Length"); ?></b> <?php echo translate("(Truncates long comments, and adds a Read More link. Set really big to disable)"); ?><br> |
525 |
<input type="text" name="commentmax" value="<?PHP echo $userinfo[commentmax] ?>" size=11 maxlength=11> bytes (1024 bytes = 1K) |
526 |
<br><br> |
527 |
<input type="hidden" name="uname" value="<?PHP echo"$userinfo[uname]"; ?>"> |
528 |
<input type="hidden" name="uid" value="<?PHP echo"$userinfo[uid]"; ?>"> |
529 |
<input type="hidden" name="op" value="savecomm"> |
530 |
<input type="submit" value="<?php echo translate("Save Changes"); ?>"> |
531 |
</form></td></tr></table> |
532 |
<?PHP |
533 |
include ("footer.php"); |
534 |
} |
535 |
|
536 |
function savecomm($uid, $uname, $umode, $uorder, $thold, $noscore, $commentmax) { |
537 |
global $user, $userinfo; |
538 |
dbconnect(); |
539 |
if(isset($noscore)) $noscore=1; else $noscore=0; |
540 |
mysql_query("LOCK TABLES users WRITE"); |
541 |
mysql_query("update users set umode='$umode', uorder='$uorder', thold='$thold', noscore='$noscore', commentmax='$commentmax' where uid=$uid"); |
542 |
getusrinfo($user); |
543 |
mysql_query("UNLOCK TABLES"); |
544 |
docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme],$userinfo[commentmax]); |
545 |
Header("Location: user.php?"); // question is wierd bugfix |
546 |
} |
547 |
|
548 |
switch($op) { |
549 |
|
550 |
case "logout": |
551 |
logout(); |
552 |
break; |
553 |
|
554 |
case "lost_pass": |
555 |
lost_pass(); |
556 |
break; |
557 |
|
558 |
case "new user": |
559 |
confirmNewUser($uname, $email); |
560 |
break; |
561 |
|
562 |
case "finish": |
563 |
finishNewUser($uname, $email); |
564 |
break; |
565 |
|
566 |
case "mailpasswd": |
567 |
mail_password($uname, $code); |
568 |
break; |
569 |
|
570 |
case "userinfo": |
571 |
dbconnect(); |
572 |
userinfo($uname, $bypass); |
573 |
break; |
574 |
|
575 |
case "login": |
576 |
login($uname, $pass); |
577 |
break; |
578 |
|
579 |
case "dummy": |
580 |
// this is needed to give the cookie a chance to digest |
581 |
include("config.php"); |
582 |
Header("Location: user.php"); |
583 |
break; |
584 |
|
585 |
case "edituser": |
586 |
edituser(); |
587 |
break; |
588 |
|
589 |
case "saveuser": |
590 |
saveuser($uid, $name, $uname, $email, $femail, $url, $pass, $vpass, $bio); |
591 |
break; |
592 |
|
593 |
case "edithome": |
594 |
edithome(); |
595 |
break; |
596 |
|
597 |
case "chgtheme": |
598 |
chgtheme(); |
599 |
break; |
600 |
|
601 |
case "savehome": |
602 |
savehome($uid, $uname, $theme, $storynum, $ublockon, $ublock); |
603 |
break; |
604 |
|
605 |
case "savetheme": |
606 |
savetheme($uid, $theme); |
607 |
break; |
608 |
|
609 |
|
610 |
case "editcomm": |
611 |
editcomm(); |
612 |
break; |
613 |
|
614 |
case "savecomm": |
615 |
savecomm($uid, $uname, $umode, $uorder, $thold, $noscore, $commentmax); |
616 |
break; |
617 |
|
618 |
default: |
619 |
main($user); |
620 |
break; |
621 |
} |
622 |
?> |