OSDN Git Service

Another small update.
[idb/iDB.git.git] / inc / profilemain.php
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
5
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
10
11     Copyright 2004-2008 Cool Dude 2k - http://idb.berlios.de/
12     Copyright 2004-2008 Game Maker 2k - http://intdb.sourceforge.net/
13
14     $FileInfo: profilemain.php - Last Update: 12/12/2008 SVN 215 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="profilemain.php"||$File3Name=="/profilemain.php") {
18         require('index.php');
19         exit(); }
20
21 // Check if we can edit the profile
22 if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['CanEditProfile']=="no") {
23 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
24 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
25 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
26 if(!isset($_POST['update'])) { $_POST['update'] = null; }
27 ?>
28 <div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Profile Editor</a></div>
29 <div class="DivNavLinks">&nbsp;</div>
30 <table class="Table3">
31 <tr style="width: 100%; vertical-align: top;">
32         <td style="width: 15%; vertical-align: top;">
33         <div class="TableSMenuBorder">
34 <?php if($ThemeSet['TableStyle']=="div") { ?>
35 <div class="TableSMenuRow1">
36 <?php echo $ThemeSet['TitleIcon']; ?>Profile Settings</div>
37 <?php } ?>
38 <table id="ProfileLinks" class="TableSMenu" style="width: 100%; text-align: left; vertical-align: top;">
39 <?php if($ThemeSet['TableStyle']=="table") { ?>
40 <tr class="TableSMenuRow1">
41 <td class="TableSMenuColumn1"><?php echo $ThemeSet['TitleIcon']; ?>Profile Settings</td>
42 </tr><?php } ?>
43 <tr class="TableSMenuRow2">
44 <td class="TableSMenuColumn2">&nbsp;</td>
45 </tr><tr class="TableSMenuRow3">
46 <td class="TableSMenuColumn3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit NotePad</a></td>
47 </tr><tr class="TableSMenuRow3">
48 <td class="TableSMenuColumn3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit Profile</a></td>
49 </tr><tr class="TableSMenuRow3">
50 <td class="TableSMenuColumn3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=signature",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit Signature</a></td>
51 </tr><tr class="TableSMenuRow3">
52 <td class="TableSMenuColumn3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=avatar",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit Avatar</a></td>
53 </tr><tr class="TableSMenuRow4">
54 <td class="TableSMenuColumn4">&nbsp;</td>
55 </tr></table></div>
56 <div class="DivSMenu">&nbsp;</div>
57 <div class="TableSMenuBorder">
58 <?php if($ThemeSet['TableStyle']=="div") { ?>
59 <div class="TableSMenuRow1">
60 <?php echo $ThemeSet['TitleIcon']; ?>Board Settings</div>
61 <?php } ?>
62 <table class="TableSMenu" style="width: 100%; text-align: left; vertical-align: top;">
63 <?php if($ThemeSet['TableStyle']=="table") { ?>
64 <tr class="TableSMenuRow1">
65 <td class="TableSMenuColumn1"><?php echo $ThemeSet['TitleIcon']; ?>Board Settings</td>
66 </tr><?php } ?>
67 <tr class="TableSMenuRow2">
68 <td class="TableSMenuColumn2">&nbsp;</td>
69 </tr><tr class="TableSMenuRow3">
70 <td class="TableSMenuColumn3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=settings",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Board Settings</a></td>
71 </tr><tr class="TableSMenuRow3">
72 <td class="TableSMenuColumn3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Change User Info</a></td>
73 </tr><tr class="TableSMenuRow4">
74 <td class="TableSMenuColumn4">&nbsp;</td>
75 </tr></table></div>
76 </td>
77         <td style="width: 85%; vertical-align: top;">
78 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
79 $updateact = url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
80 $profiletitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
81 @redirect("refresh",$basedir.url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile'],FALSE),"3");
82 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
83 $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
84 ?>
85 <div class="TableMenuBorder">
86 <?php if($ThemeSet['TableStyle']=="div") { ?>
87 <div class="TableMenuRow1">
88 <span style="text-align: left;">
89 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $updateact; ?>">Updating Settings</a>
90 </span></div>
91 <?php } ?>
92 <table class="TableMenu" style="width: 100%;">
93 <?php if($ThemeSet['TableStyle']=="table") { ?>
94 <tr class="TableMenuRow1">
95 <td class="TableMenuColumn1"><span style="text-align: left;">
96 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $updateact; ?>">Updating Settings</a>
97 </span></td>
98 </tr><?php } ?>
99 <tr id="ProfileTitle" class="TableMenuRow2">
100 <th class="TableMenuColumn2">Updating Settings</th>
101 </tr>
102 <tr class="TableMenuRow3" id="ProfileUpdate">
103 <td class="TableMenuColumn3">
104 <div style="text-align: center;">
105 <br />Profile updated <a href="<?php echo $updateact; ?>">click here</a> to go back. ^_^<br />&nbsp;</div>
106 <?php } if($_GET['act']=="view") {
107 if($_POST['update']!="now") {
108 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
109 $result=mysql_query($query);
110 $num=mysql_num_rows($result);
111 $i=0;
112 $YourID=mysql_result($result,$i,"id");
113 $Notes=mysql_result($result,$i,"Notes");
114 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
115 $notepadact = $noteact; $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
116 ?>
117 <div class="TableMenuBorder">
118 <?php if($ThemeSet['TableStyle']=="div") { ?>
119 <div class="TableMenuRow1">
120 <span style="text-align: left;">
121 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $noteact; ?>">NotePad</a>
122 </span></div>
123 <?php } ?>
124 <table class="TableMenu" style="width: 100%;">
125 <?php if($ThemeSet['TableStyle']=="table") { ?>
126 <tr class="TableMenuRow1">
127 <td class="TableMenuColumn1"><span style="text-align: left;">
128 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $noteact; ?>">NotePad</a>
129 </span></td>
130 </tr><?php } ?>
131 <tr id="ProfileTitle" class="TableMenuRow2">
132 <th class="TableMenuColumn2">NotePad</th>
133 </tr>
134 <tr class="TableMenuRow3" id="NotePadRow">
135 <td class="TableMenuColumn3">
136 <form style="display: inline;" method="post" action="<?php echo $notepadact; ?>"><div style="text-align: center;">
137 <label class="TextBoxLabel" for="NotePad">Your NotePad</label><br />
138 <textarea class="TextBox" name="NotePad" id="NotePad" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Notes; ?></textarea>
139 <input type="hidden" name="act" value="view" style="display: none;" />
140 <input type="hidden" name="update" value="now" style="display: none;" />
141 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
142 </div></form></td>
143 </tr>
144 <tr id="ProfileEnd" class="TableMenuRow4">
145 <td class="TableMenuColumn4">&nbsp;</td>
146 </tr>
147 </table>
148 </div>
149 <?php @mysql_free_result($result); }
150 if($_POST['update']=="now") {
151 if($_POST['act']=="view"&&
152         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
153         $_POST['NotePad'] = htmlspecialchars($_POST['NotePad'], ENT_QUOTES, $Settings['charset']);
154         $_POST['NotePad'] = remove_bad_entities($_POST['NotePad']);
155         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
156         //$_POST['Signature'] = @remove_spaces($_POST['Signature']);
157         //$_POST['Signature'] = remove_bad_entities($_POST['Signature']);
158         /*    <_<  iWordFilter  >_>      
159     by Kazuki Przyborowski - Cool Dude 2k */
160         $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
161         $katarzynart=mysql_query($katarzynaqy);
162         $katarzynanm=mysql_num_rows($katarzynart);
163         $katarzynas=0;
164         while ($katarzynas < $katarzynanm) {
165         $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
166         $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
167         $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
168         if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
169         if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
170         if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
171         $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
172         if($WholeWord=="on") { $WholeWord = "yes"; }
173         if($WholeWord=="off") { $WholeWord = "no"; }
174         if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
175         $Filter = preg_quote($Filter, "/");
176         if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
177         $_POST['NotePad'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['NotePad']); }
178         if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
179         $_POST['NotePad'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['NotePad']); }
180         if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
181         $_POST['NotePad'] = preg_replace("/".$Filter."/", $Replace, $_POST['NotePad']); }
182         if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
183         $_POST['NotePad'] = preg_replace("/".$Filter."/i", $Replace, $_POST['NotePad']); }
184         ++$katarzynas; } @mysql_free_result($katarzynart);
185         $NewDay=GMTimeStamp();
186         $NewIP=$_SERVER['REMOTE_ADDR'];
187         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `Notes`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['NotePad'],$NewDay,$NewIP,$_SESSION['UserID']));
188                 mysql_query($querynewskin); } } }
189 if($_GET['act']=="signature") {
190 if($_POST['update']!="now") {
191 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
192 $result=mysql_query($query);
193 $num=mysql_num_rows($result);
194 $i=0;
195 $YourID=mysql_result($result,$i,"id");
196 $Signature=mysql_result($result,$i,"Signature"); 
197 $signatureact = url_maker($exfile['profile'],$Settings['file_ext'],"act=signature",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
198 $profiletitle = " ".$ThemeSet['TitleDivider']." Signature Editor";
199 ?>
200 <div class="TableMenuBorder">
201 <?php if($ThemeSet['TableStyle']=="div") { ?>
202 <div class="TableMenuRow1">
203 <span style="text-align: left;">
204 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $signatureact; ?>">Signature Editer</a>
205 </span></div>
206 <?php } ?>
207 <table class="TableMenu" style="width: 100%;">
208 <?php if($ThemeSet['TableStyle']=="table") { ?>
209 <tr class="TableMenuRow1">
210 <td class="TableMenuColumn1"><span style="text-align: left;">
211 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $signatureact; ?>">Signature Editer</a>
212 </span></td>
213 </tr><?php } ?>
214 <tr id="ProfileTitle" class="TableMenuRow2">
215 <th class="TableMenuColumn2">Signature Editor</th>
216 </tr>
217 <tr class="TableMenuRow3" id="SignatureRow">
218 <td class="TableMenuColumn3">
219 <form style="display: inline;" method="post" action="<?php echo $signatureact; ?>"><div style="text-align: center;">
220 <label class="TextBoxLabel" for="Signature">Your Signature</label><br />
221 <textarea class="TextBox" name="Signature" id="Signature" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Signature; ?></textarea>
222 <input type="hidden" name="act" value="signature" style="display: none;" />
223 <input type="hidden" name="update" value="now" style="display: none;" />
224 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
225 </div></form></td>
226 </tr>
227 <tr id="ProfileEnd" class="TableMenuRow4">
228 <td class="TableMenuColumn4">&nbsp;</td>
229 </tr>
230 </table>
231 </div>
232 <?php @mysql_free_result($result); }
233 if($_POST['update']=="now") {
234 if($_POST['act']=="signature"&&
235         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
236         $_POST['Signature'] = stripcslashes(htmlspecialchars($_POST['Signature'], ENT_QUOTES));
237         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
238         //$_POST['Signature'] = @remove_spaces($_POST['Signature']);
239         $_POST['Signature'] = remove_bad_entities($_POST['Signature']);
240         /*    <_<  iWordFilter  >_>      
241     by Kazuki Przyborowski - Cool Dude 2k */
242         $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
243         $katarzynart=mysql_query($katarzynaqy);
244         $katarzynanm=mysql_num_rows($katarzynart);
245         $katarzynas=0;
246         while ($katarzynas < $katarzynanm) {
247         $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
248         $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
249         $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
250         if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
251         if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
252         if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
253         $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
254         if($WholeWord=="on") { $WholeWord = "yes"; }
255         if($WholeWord=="off") { $WholeWord = "no"; }
256         if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
257         $Filter = preg_quote($Filter, "/");
258         if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
259         $_POST['Signature'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['Signature']); }
260         if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
261         $_POST['Signature'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['Signature']); }
262         if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
263         $_POST['Signature'] = preg_replace("/".$Filter."/", $Replace, $_POST['Signature']); }
264         if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
265         $_POST['Signature'] = preg_replace("/".$Filter."/i", $Replace, $_POST['Signature']); }
266         ++$katarzynas; } @mysql_free_result($katarzynart);
267         $NewDay=GMTimeStamp();
268         $NewIP=$_SERVER['REMOTE_ADDR'];
269         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `Signature`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['Signature'],$NewDay,$NewIP,$_SESSION['UserID']));
270         mysql_query($querynewskin); } } }
271 if($_GET['act']=="avatar") {
272 if($_POST['update']!="now") {
273 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
274 $result=mysql_query($query);
275 $num=mysql_num_rows($result);
276 $i=0;
277 $YourID=mysql_result($result,$i,"id");
278 $User1Avatar=mysql_result($result,$i,"Avatar"); 
279 $User1AvatarSize=mysql_result($result,$i,"AvatarSize");
280 $avataract = url_maker($exfile['profile'],$Settings['file_ext'],"act=avatar",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
281 $profiletitle = " ".$ThemeSet['TitleDivider']." Avatar Editor";
282 $Pre1Avatar = $User1Avatar;
283 if ($User1Avatar==null) { $User1Avatar="http://"; }
284 if ($Pre1Avatar=="http://"||$Pre1Avatar==null||
285         strtolower($Pre1Avatar)=="noavatar") {
286 $Pre1Avatar=$ThemeSet['NoAvatar'];
287 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
288 $AvatarSize1=explode("x", $User1AvatarSize);
289 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
290 ?>
291 <div class="TableMenuBorder">
292 <?php if($ThemeSet['TableStyle']=="div") { ?>
293 <div class="TableMenuRow1">
294 <span style="text-align: left;">
295 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $avataract; ?>">Avatar Editer</a>
296 </span></div>
297 <?php } ?>
298 <table class="TableMenu" style="width: 100%;">
299 <?php if($ThemeSet['TableStyle']=="table") { ?>
300 <tr class="TableMenuRow1">
301 <td class="TableMenuColumn1"><span style="text-align: left;">
302 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $avataract; ?>">Avatar Editer</a>
303 </span></td>
304 </tr><?php } ?>
305 <tr id="ProfileTitle" class="TableMenuRow2">
306 <th class="TableMenuColumn2">Avatar Editor</th>
307 </tr>
308 <tr class="TableMenuRow3" id="AvatarEditor">
309 <td class="TableMenuColumn3">
310 <form style="display: inline;" method="post" action="<?php echo $avataract; ?>">
311  <?php  /* Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/ */  ?>
312  <table class="AvatarTable" style="width: 100px; height: 100px; text-align: center;">
313         <tr class="AvatarRow" style="width: 100%; height: 100%;">
314                 <td class="AvatarRow" style="width: 100%; height: 100%; text-align: center; vertical-align: middle;">
315                 <img src="<?php echo $Pre1Avatar; ?>" alt="<?php echo $_SESSION['MemberName']; ?>'s Avatar" title="<?php echo $_SESSION['MemberName']; ?>'s Avatar" style="border: 0px; width: <?php echo $AvatarSize1W; ?>px; height: <?php echo $AvatarSize1H; ?>px;" />
316                 </td>
317         </tr>
318  </table>
319 <table style="text-align: left;">
320 <tr style="text-align: left;">
321         <td style="width: 40%;"><label class="TextBoxLabel" for="Avatar">Your Avatar</label></td>
322         <td style="width: 60%;"><input type="text" class="TextBox" name="Avatar" id="Avatar" value="<?php echo $User1Avatar; ?>" size="20" /></td>
323         </tr><tr style="text-align: left;">
324         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeW">Avatar Width</label></td>
325         <td style="width: 60%;"><select size="1" name="AvatarSizeW" id="AvatarSizeW" class="TextBox">
326         <option value="<?php echo $AvatarSize1W; ?>" selected="selected"><?php echo $AvatarSize1W; ?></option><?php echo "\n"; $r=1; while ($r <= 100) { ?><option value="<?php echo $r ?>"><?php echo $r; ?></option><?php echo "\n"; ++$r; } ?>
327 </select></td>
328 </tr><tr style="text-align: left;">
329         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeH">Avatar Height</label></td>
330         <td style="width: 60%;"><select size="1" name="AvatarSizeH" id="AvatarSizeH" class="TextBox">
331 <option value="<?php echo $AvatarSize1H; ?>" selected="selected"><?php echo $AvatarSize1H; ?></option><?php echo "\n"; $s=1; while ($s <= 100) { ?><option value="<?php echo $s ?>"><?php echo $s; ?></option><?php echo "\n"; ++$s; } ?>
332 </select></td>
333 </tr></table>
334 <table style="text-align: left;">
335 <tr style="text-align: left;">
336 <td style="width: 100%;">
337 <input type="hidden" name="act" value="avatar" style="display: none;" />
338 <input type="hidden" name="update" value="now" style="display: none;" />
339 <input type="submit" class="Button" value="Save" />
340 <input class="Button" type="reset" />
341 </td></tr></table>
342 </form></td>
343 </tr>
344 <tr id="ProfileEnd" class="TableMenuRow4">
345 <td class="TableMenuColumn4">&nbsp;</td>
346 </tr>
347 </table>
348 </div>
349 <?php @mysql_free_result($result); }
350 if($_POST['update']=="now") {
351 if($_POST['Avatar']!=null&&$_POST['AvatarSizeW']!=null&&$_POST['AvatarSizeH']!=null&&
352         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
353         if(!is_numeric($_POST['AvatarSizeW'])) { $_POST['AvatarSizeW'] = 100; }
354         if($_POST['AvatarSizeW']>=100) { $_POST['AvatarSizeW']=100; }
355         if(!is_numeric($_POST['AvatarSizeH'])) { $_POST['AvatarSizeH'] = 100; }
356         if($_POST['AvatarSizeH']>=100) { $_POST['AvatarSizeH']=100; }
357         $fullavatarsize = $_POST['AvatarSizeW']."x".$_POST['AvatarSizeH'];
358         $_POST['Avatar'] = htmlentities($_POST['Avatar'], ENT_QUOTES, $Settings['charset']);
359         $NewDay=GMTimeStamp();
360         $NewIP=$_SERVER['REMOTE_ADDR'];
361         $_POST['Avatar'] = @remove_spaces($_POST['Avatar']);
362         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `Avatar`='%s',`AvatarSize`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['Avatar'],$fullavatarsize,$NewDay,$NewIP,$_SESSION['UserID']));
363         mysql_query($querynewskin); } } }
364 if($_GET['act']=="settings") {
365 if($_POST['update']!="now") {
366 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
367 $result=mysql_query($query);
368 $num=mysql_num_rows($result);
369 $i=0;
370 $YourID=mysql_result($result,$i,"id");
371 $User1TimeZone=mysql_result($result,$i,"TimeZone"); 
372 $tsa_mem = explode(":",$User1TimeZone);
373 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
374 $User1DST=mysql_result($result,$i,"DST");
375 $settingsact = url_maker($exfile['profile'],$Settings['file_ext'],"act=settings",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
376 $profiletitle = " ".$ThemeSet['TitleDivider']." Board Settings"; ?>
377 <div class="TableMenuBorder">
378 <?php if($ThemeSet['TableStyle']=="div") { ?>
379 <div class="TableMenuRow1">
380 <span style="text-align: left;">
381 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $settingsact; ?>">Board Settings</a>
382 </span></div>
383 <?php } ?>
384 <table class="TableMenu" style="width: 100%;">
385 <?php if($ThemeSet['TableStyle']=="table") { ?>
386 <tr class="TableMenuRow1">
387 <td class="TableMenuColumn1"><span style="text-align: left;">
388 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $settingsact; ?>">Board Settings</a>
389 </span></td>
390 </tr><?php } ?>
391 <tr id="ProfileTitle" class="TableMenuRow2">
392 <th class="TableMenuColumn2">Board Settings</th>
393 </tr>
394 <tr class="TableMenuRow3" id="BoardSettings">
395 <td class="TableMenuColumn3">
396 <form style="display: inline;" method="post" action="<?php echo $settingsact; ?>">
397 <table style="text-align: left;">
398 <tr style="text-align: left;">
399         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
400         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
401 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
402 <?php
403 $plusi = 1; $minusi = 12;
404 $plusnum = 13; $minusnum = 0;
405 while ($minusi > $minusnum) {
406 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
407 --$minusi; }
408 ?>
409 <option value="0">GMT +/- 0:00 hours</option>
410 <?php
411 while ($plusi < $plusnum) {
412 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
413 ++$plusi; }
414 ?></select></td>
415 </tr><tr style="text-align: left;">
416         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
417         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
418 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
419 <?php
420 $mini = 0; $minnum = 60;
421 while ($mini < $minnum) {
422 if(pre_strlen($mini)==2) { $showmin = $mini; }
423 if(pre_strlen($mini)==1) { $showmin = "0".$mini; }
424 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
425 ++$mini; }
426 ?></select></td>
427 </tr><tr style="text-align: left;">
428         <td style="width: 40%;"><label class="TextBoxLabel" for="skin">Pick a CSS Theme</label></td>
429         <td style="width: 60%;"><select id="skin" name="skin" class="TextBox">
430 <option selected="selected" value="<?php echo $_SESSION['Theme']; ?>">Old Value (<?php echo $_SESSION['Theme']; ?>)</option><?php
431 $skindir = dirname(realpath("settings.php"))."/".$SettDir['themes'];
432 if ($handle = opendir($skindir)) { $dirnum = null;
433    while (false !== ($file = readdir($handle))) {
434            if ($dirnum==null) { $dirnum = 0; }
435            if (file_exists($skindir.$file."/info.php")) {
436                    if ($file != "." && $file != "..") {
437            include($skindir.$file."/info.php");
438        $themelist[$dirnum] =  "<option value=\"".$file."\">".$ThemeInfo['ThemeName']."</option>";
439            ++$dirnum; } } }
440    closedir($handle); asort($themelist);
441    $themenum=count($themelist); $themei=0; 
442    while ($themei < $themenum) {
443    echo $themelist[$themei]."\n";
444    ++$themei; }
445 } ?></select></td>
446 </tr><tr style="text-align: left;">
447         <td style="width: 40%;"><label class="TextBoxLabel" for="RepliesPerPage">Replies Per Page:</label></td>
448         <td style="width: 60%;"><select id="RepliesPerPage" name="RepliesPerPage" class="TextBox">
449 <option selected="selected" value="<?php echo $Settings['max_posts']; ?>">Old Value (<?php echo $Settings['max_posts']; ?>)</option>
450 <option value="5">5</option>
451 <option value="10">10</option>
452 <option value="15">15</option>
453 <option value="20">20</option>
454 <option value="25">25</option>
455 <option value="30">30</option>
456 </select></td>
457 </tr><tr style="text-align: left;">
458         <td style="width: 40%;"><label class="TextBoxLabel" for="TopicsPerPage">Topics Per Page:</label></td>
459         <td style="width: 60%;"><select id="TopicsPerPage" name="TopicsPerPage" class="TextBox">
460 <option selected="selected" value="<?php echo $Settings['max_topics']; ?>">Old Value (<?php echo $Settings['max_topics']; ?>)</option>
461 <option value="5">5</option>
462 <option value="10">10</option>
463 <option value="15">15</option>
464 <option value="20">20</option>
465 <option value="25">25</option>
466 <option value="30">30</option>
467 </select></td>
468 </tr><tr style="text-align: left;">
469         <td style="width: 40%;"><label class="TextBoxLabel" for="MessagesPerPage">Messages/Members Per Page:</label></td>
470         <td style="width: 60%;"><select id="MessagesPerPage" name="MessagesPerPage" class="TextBox">
471 <option selected="selected" value="<?php echo $Settings['max_pmlist']; ?>">Old Value (<?php echo $Settings['max_pmlist']; ?>)</option>
472 <option value="5">5</option>
473 <option value="10">10</option>
474 <option value="15">15</option>
475 <option value="20">20</option>
476 <option value="25">25</option>
477 <option value="30">30</option>
478 </select></td>
479 </tr><tr style="text-align: left;">
480         <td style="width: 40%;"><label class="TextBoxLabel" for="DST">Is <span title="Daylight Savings Time">DST</span> / <span title="Summer Time">ST</span> on or off:</label></td>
481         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
482 <?php if($User1DST=="off"||$User1DST!="on") { ?>
483 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
484 <?php } if($User1DST=="on") { ?>
485 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
486 <?php } echo "\n" ?></select></td>
487 </tr></table>
488 <table style="text-align: left;">
489 <tr style="text-align: left;">
490 <td style="width: 100%;">
491 <input type="hidden" name="act" value="settings" style="display: none;" />
492 <input type="hidden" name="update" value="now" style="display: none;" />
493 <input type="submit" class="Button" value="Save" />
494 <input class="Button" type="reset" />
495 </td></tr></table>
496 </form></td>
497 </tr>
498 <tr id="ProfileEnd" class="TableMenuRow4">
499 <td class="TableMenuColumn4">&nbsp;</td>
500 </tr>
501 </table>
502 </div>
503 <?php @mysql_free_result($result); }
504 if($_POST['update']=="now") {
505 if($_POST['act']=="settings"&&
506         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
507         $NewDay=GMTimeStamp();
508         $NewIP=$_SERVER['REMOTE_ADDR'];
509         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
510         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
511         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
512         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
513         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
514         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
515         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
516         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
517         $_SESSION['UserDST'] = $_POST['DST'];
518         if(!is_numeric($_POST['RepliesPerPage'])) { $_POST['RepliesPerPage'] = "10"; }
519         if(!is_numeric($_POST['TopicsPerPage'])) { $_POST['TopicsPerPage'] = "10"; }
520         if(!is_numeric($_POST['MessagesPerPage'])) { $_POST['MessagesPerPage'] = "10"; }
521         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `UseTheme`='%s',`TimeZone`='%s',`DST`='%s',`LastActive`=%i,RepliesPerPage=%i,TopicsPerPage=%i,MessagesPerPage=%i,`IP`='%s' WHERE `id`=%i", array($_POST['skin'],$_POST['YourOffSet'],$_POST['DST'],$NewDay,$_POST['RepliesPerPage'],$_POST['TopicsPerPage'],$_POST['MessagesPerPage'],$NewIP,$_SESSION['UserID']));
522         mysql_query($querynewskin); } } }
523 if($_GET['act']=="profile") {
524 if($_POST['update']!="now") {
525 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
526 $result=mysql_query($query);
527 $num=mysql_num_rows($result);
528 $i=0;
529 $YourID=mysql_result($result,$i,"id");
530 $User1Interests=mysql_result($result,$i,"Interests"); 
531 $User1Title=mysql_result($result,$i,"Title");
532 $User1Website=mysql_result($result,$i,"Website"); 
533 $User1Gender=mysql_result($result,$i,"Gender");
534 $User1TimeZone=mysql_result($result,$i,"TimeZone");
535 $BirthDay=mysql_result($result,$i,"BirthDay");
536 $BirthMonth=mysql_result($result,$i,"BirthMonth");
537 $BirthYear=mysql_result($result,$i,"BirthYear");
538 $User1Birthday = "MM/DD/YYYY";
539 if($BirthMonth!=null&&$BirthDay!=null&&$BirthYear!=null) { 
540         if($BirthYear=="0") { $BirthYear = "YYYY"; }
541         if($BirthDay=="0") { $BirthDay = "DD"; }
542         if($BirthMonth=="0") { $BirthMonth = "MM"; }
543         if(pre_strlen($BirthMonth)=="1") { $BirthMonth = "0".$BirthMonth; }
544         if(pre_strlen($BirthDay)=="1") { $BirthDay = "0".$BirthDay; }
545     if($BirthYear!="MM"&&$BirthYear!="DD"&&$BirthYear!="YYYY"&&
546         checkdate($BirthMonth,$BirthDay,$BirthYear)===false) {
547         $BirthMonth = "MM"; $BirthDay = "DD"; $BirthYear = "YYYY"; }
548         $User1Birthday = $BirthMonth."/".$BirthDay."/".$BirthYear; }
549 $tsa_mem = explode(":",$User1TimeZone);
550 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
551 $User1DST=mysql_result($result,$i,"DST");
552 $profileact = url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
553 $profiletitle = " ".$ThemeSet['TitleDivider']." Profile Editor";
554 ?>
555 <div class="TableMenuBorder">
556 <?php if($ThemeSet['TableStyle']=="div") { ?>
557 <div class="TableMenuRow1">
558 <span style="text-align: left;">
559 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
560 </span></div>
561 <?php } ?>
562 <table class="TableMenu" style="width: 100%;">
563 <?php if($ThemeSet['TableStyle']=="table") { ?>
564 <tr class="TableMenuRow1">
565 <td class="TableMenuColumn1"><span style="text-align: left;">
566 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
567 </span></td>
568 </tr><?php } ?>
569 <tr id="ProfileTitle" class="TableMenuRow2">
570 <th class="TableMenuColumn2">Profile Editor</th>
571 </tr>
572 <tr class="TableMenuRow3" id="ProfileEditor">
573 <td class="TableMenuColumn3">
574 <form style="display: inline;" method="post" action="<?php echo $profileact; ?>">
575 <table style="text-align: left;">
576 <tr style="text-align: left;">
577         <td style="width: 40%;"><label class="TextBoxLabel" for="Interests">Your Interests</label></td>
578         <td style="width: 60%;"><input type="text" class="TextBox" name="Interests" id="Interests" value="<?php echo $User1Interests; ?>" /></td>
579 </tr><tr style="text-align: left;">
580         <td style="width: 40%;"><label class="TextBoxLabel" for="Title">Your Title</label></td>
581         <td style="width: 60%;"><input type="text" class="TextBox" name="Title" id="Title" value="<?php echo $User1Title; ?>" /></td>
582 </tr><tr style="text-align: left;">
583         <td style="width: 40%;"><label class="TextBoxLabel" for="Website">Your Website</label></td>
584         <td style="width: 60%;"><input type="text" class="TextBox" name="Website" id="Website" value="<?php echo $User1Website; ?>" /></td>
585 </tr><tr style="text-align: left;">
586         <td style="width: 40%;"><label class="TextBoxLabel" for="EventDay">Your Birthday</label></td>
587         <td style="width: 60%;"><input maxlength="10" type="text" class="TextBox" name="EventDay" id="EventDay" value="<?php echo $User1Birthday; ?>" /></td>
588 </tr><tr style="text-align: left;">
589         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
590         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
591 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
592 <?php
593 $plusi = 1; $minusi = 12;
594 $plusnum = 13; $minusnum = 0;
595 while ($minusi > $minusnum) {
596 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
597 --$minusi; }
598 ?>
599 <option value="0">GMT +/- 0:00 hours</option>
600 <?php
601 while ($plusi < $plusnum) {
602 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
603 ++$plusi; }
604 ?></select></td>
605 </tr><tr style="text-align: left;">
606         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
607         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
608 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
609 <?php
610 $mini = 0; $minnum = 60;
611 while ($mini < $minnum) {
612 if(pre_strlen($mini)==2) { $showmin = $mini; }
613 if(pre_strlen($mini)==1) { $showmin = "0".$mini; }
614 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
615 ++$mini; }
616 ?></select></td>
617 </tr><tr style="text-align: left;">
618         <td style="width: 40%;"><label class="TextBoxLabel" for="YourGender">Your Gender:</label></td>
619         <td style="width: 60%;"><select id="YourGender" name="YourGender" class="TextBox">
620 <option selected="selected" value="<?php echo $User1Gender; ?>">Old Value (<?php echo $User1Gender; ?>)</option>
621 <option value="Male">Male</option>
622 <option value="Female">Female</option>
623 <option value="Unknow">Unknow</option>
624 </select></td>
625 </tr><tr style="text-align: left;">
626         <td style="width: 40%;"><label class="TextBoxLabel" for="RepliesPerPage">Replies Per Page:</label></td>
627         <td style="width: 60%;"><select id="RepliesPerPage" name="RepliesPerPage" class="TextBox">
628 <option selected="selected" value="<?php echo $Settings['max_posts']; ?>">Old Value (<?php echo $Settings['max_posts']; ?>)</option>
629 <option value="5">5</option>
630 <option value="10">10</option>
631 <option value="15">15</option>
632 <option value="20">20</option>
633 <option value="25">25</option>
634 <option value="30">30</option>
635 </select></td>
636 </tr><tr style="text-align: left;">
637         <td style="width: 40%;"><label class="TextBoxLabel" for="TopicsPerPage">Topics Per Page:</label></td>
638         <td style="width: 60%;"><select id="TopicsPerPage" name="TopicsPerPage" class="TextBox">
639 <option selected="selected" value="<?php echo $Settings['max_topics']; ?>">Old Value (<?php echo $Settings['max_topics']; ?>)</option>
640 <option value="5">5</option>
641 <option value="10">10</option>
642 <option value="15">15</option>
643 <option value="20">20</option>
644 <option value="25">25</option>
645 <option value="30">30</option>
646 </select></td>
647 </tr><tr style="text-align: left;">
648         <td style="width: 40%;"><label class="TextBoxLabel" for="MessagesPerPage">Messages/Members Per Page:</label></td>
649         <td style="width: 60%;"><select id="MessagesPerPage" name="MessagesPerPage" class="TextBox">
650 <option selected="selected" value="<?php echo $Settings['max_pmlist']; ?>">Old Value (<?php echo $Settings['max_pmlist']; ?>)</option>
651 <option value="5">5</option>
652 <option value="10">10</option>
653 <option value="15">15</option>
654 <option value="20">20</option>
655 <option value="25">25</option>
656 <option value="30">30</option>
657 </select></td>
658 </tr><tr style="text-align: left;">
659         <td style="width: 40%;"><label class="TextBoxLabel" for="DST">Is <span title="Daylight Savings Time">DST</span> / <span title="Summer Time">ST</span> on or off:</label></td>
660         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
661 <?php if($User1DST=="off"||$User1DST!="on") { ?>
662 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
663 <?php } if($User1DST=="on") { ?>
664 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
665 <?php } echo "\n" ?></select></td>
666 </tr></table>
667 <table style="text-align: left;">
668 <tr style="text-align: left;">
669 <td style="width: 100%;">
670 <input type="hidden" name="act" value="profile" style="display: none;" />
671 <input type="hidden" name="update" value="now" style="display: none;" />
672 <input type="submit" class="Button" value="Save" />
673 <input class="Button" type="reset" />
674 </td></tr></table>
675 </form></td>
676 </tr>
677 <tr id="ProfileEnd" class="TableMenuRow4">
678 <td class="TableMenuColumn4">&nbsp;</td>
679 </tr>
680 </table>
681 </div>
682 <?php @mysql_free_result($result); }
683 if($_POST['update']=="now") {
684 if($_POST['act']=="profile"&&
685         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
686         $_POST['Interests'] = htmlspecialchars($_POST['Interests'], ENT_QUOTES, $Settings['charset']);
687         $_POST['Interests'] = @remove_spaces($_POST['Interests']);
688         $_POST['Title'] = htmlspecialchars($_POST['Title'], ENT_QUOTES, $Settings['charset']);
689         $_POST['Title'] = @remove_spaces($_POST['Title']);
690         $_POST['Website'] = htmlentities($_POST['Website'], ENT_QUOTES, $Settings['charset']);
691         $_POST['Website'] = @remove_spaces($_POST['Website']);
692         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
693         //$_POST['Signature'] = @remove_spaces($_POST['Signature']);
694         //$_POST['Signature'] = remove_bad_entities($_POST['Signature']);
695         /*    <_<  iWordFilter  >_>      
696     by Kazuki Przyborowski - Cool Dude 2k */
697         $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
698         $katarzynart=mysql_query($katarzynaqy);
699         $katarzynanm=mysql_num_rows($katarzynart);
700         $katarzynas=0;
701         while ($katarzynas < $katarzynanm) {
702         $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
703         $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
704         $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
705         if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
706         if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
707         if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
708         $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
709         if($WholeWord=="on") { $WholeWord = "yes"; }
710         if($WholeWord=="off") { $WholeWord = "no"; }
711         if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
712         $Filter = preg_quote($Filter, "/");
713         if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
714         $_POST['Interests'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['Interests']);
715         $_POST['Title'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['Title']); }
716         if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
717         $_POST['Interests'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['Interests']);
718         $_POST['Title'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['Title']); }
719         if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
720         $_POST['Interests'] = preg_replace("/".$Filter."/", $Replace, $_POST['Interests']);
721         $_POST['Title'] = preg_replace("/".$Filter."/", $Replace, $_POST['Title']); }
722         if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
723         $_POST['Interests'] = preg_replace("/".$Filter."/i", $Replace, $_POST['Interests']); 
724         $_POST['Title'] = preg_replace("/".$Filter."/i", $Replace, $_POST['Title']); }
725         ++$katarzynas; } @mysql_free_result($katarzynart);
726         if(!is_numeric($_POST['RepliesPerPage'])) { $_POST['RepliesPerPage'] = "10"; }
727         if(!is_numeric($_POST['TopicsPerPage'])) { $_POST['TopicsPerPage'] = "10"; }
728         if(!is_numeric($_POST['MessagesPerPage'])) { $_POST['MessagesPerPage'] = "10"; }
729         if(!isset($_POST['EventDay'])) { $_POST['EventDay'] = null; }
730         if($_POST['EventDay']!=null) {
731         $BirthExpl = explode("/",$_POST['EventDay']);
732         if(count($BirthExpl)!="3") { 
733         $BirthExpl[0] = "0"; $BirthExpl[1] = "0"; $BirthExpl[2] = "0"; }
734         if(!is_numeric($BirthExpl[0])) { $BirthExpl[0] = "0"; }
735         if(!is_numeric($BirthExpl[1])) { $BirthExpl[1] = "0"; }
736         if(!is_numeric($BirthExpl[2])) { $BirthExpl[2] = "0"; }
737         if(count($BirthExpl)=="3"&&checkdate($BirthExpl[0],$BirthExpl[1],$BirthExpl[2])===true) {
738         if(is_numeric($BirthExpl[0])&&is_numeric($BirthExpl[1])&&is_numeric($BirthExpl[2])) {
739         if(pre_strlen($BirthExpl[0])=="1") { $BirthExpl[0] = "0".$BirthExpl[0]; }
740         if(pre_strlen($BirthExpl[1])=="1") { $BirthExpl[1] = "0".$BirthExpl[1]; }
741         if(pre_strlen($BirthExpl[0])=="2"&&pre_strlen($BirthExpl[1])=="2"&&pre_strlen($BirthExpl[2])=="4") {
742         $BirthIn = mktime(12,12,12,$BirthExpl[0],$BirthExpl[1],$BirthExpl[2]);
743         $BirthMonth=GMTimeChange("m",$BirthIn,0,0,"off");
744         $BirthDay=GMTimeChange("d",$BirthIn,0,0,"off");
745         $BirthYear=GMTimeChange("Y",$BirthIn,0,0,"off"); }
746         if(pre_strlen($BirthExpl[0])!="2"||pre_strlen($BirthExpl[1])!="2"||pre_strlen($BirthExpl[2])!="4") { 
747                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
748         if (!is_numeric($BirthExpl[0])||!is_numeric($BirthExpl[1])||!is_numeric($BirthExpl[2])) { 
749                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
750         if(count($BirthExpl)=="3"&&
751         checkdate($BirthExpl[0],$BirthExpl[1],$BirthExpl[2])===false) {
752         $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
753         if(count($BirthExpl)!="3") { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
754         if($_POST['EventDay']==null) { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
755         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
756         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
757         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
758         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
759         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
760         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
761         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
762         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
763         $_SESSION['UserDST'] = $_POST['DST'];
764         $NewDay=GMTimeStamp();
765         $NewIP=$_SERVER['REMOTE_ADDR'];
766         $querynewprofile = query("UPDATE `".$Settings['sqltable']."members` SET `Interests`='%s',`Title`='%s',`Website`='%s',`TimeZone`='%s',`Gender`='%s',`DST`='%s',`LastActive`=%i,`BirthMonth`=%i,`BirthDay`=%i,`BirthYear`=%i,RepliesPerPage=%i,TopicsPerPage=%i,MessagesPerPage=%i,`IP`='%s' WHERE `id`=%i", array($_POST['Interests'],$_POST['Title'],$_POST['Website'],$_POST['YourOffSet'],$_POST['YourGender'],$_POST['DST'],$NewDay,$BirthMonth,$BirthDay,$BirthYear,$_POST['RepliesPerPage'],$_POST['TopicsPerPage'],$_POST['MessagesPerPage'],$NewIP,$_SESSION['UserID']));
767         mysql_query($querynewprofile); } } }
768 if($_GET['act']=="userinfo") {
769 if($_POST['update']!="now") {
770 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
771 $result=mysql_query($query);
772 $num=mysql_num_rows($result);
773 $i=0;
774 $YourID=mysql_result($result,$i,"id");
775 $User1Email=mysql_result($result,$i,"Email"); 
776 $userinfoact = url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
777 $profiletitle = " ".$ThemeSet['TitleDivider']." User Info Editer";
778 ?>
779 <div class="TableMenuBorder">
780 <?php if($ThemeSet['TableStyle']=="div") { ?>
781 <div class="TableMenuRow1">
782 <span style="text-align: left;">
783 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
784 </span></div>
785 <?php } ?>
786 <table class="TableMenu" style="width: 100%;">
787 <?php if($ThemeSet['TableStyle']=="table") { ?>
788 <tr class="TableMenuRow1">
789 <td class="TableMenuColumn1"><span style="text-align: left;">
790 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
791 </span></td>
792 </tr><?php } ?>
793 <tr id="ProfileTitle" class="TableMenuRow2">
794 <th class="TableMenuColumn2">User Info Editer</th>
795 </tr>
796 <tr class="TableMenuRow3" id="UserInfoEditor">
797 <td class="TableMenuColumn3">
798 <form style="display: inline;" method="post" action="<?php echo $userinfoact; ?>">
799 <table style="text-align: left;">
800 <tr style="text-align: left;">
801         <td style="width: 40%;"><label class="TextBoxLabel" for="OldPass">Insert old Password:</label></td>
802         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="OldPass" size="20" id="OldPass" /></td>
803 </tr><tr style="text-align: left;">
804         <td style="width: 40%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
805         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="Password" size="20" id="Password" /></td>
806 </tr><tr style="text-align: left;">
807         <td style="width: 40%;"><label class="TextBoxLabel" for="RePassword">ReInsert a Password:</label></td>
808         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="RePassword" size="20" id="RePassword" /></td>
809 </tr><tr style="text-align: left;">
810         <td style="width: 40%;"><label class="TextBoxLabel" for="Email">Insert Your Email:</label></td>
811         <td style="width: 60%;"><input type="text" class="TextBox" name="Email" size="20" id="Email" value="<?php echo $User1Email; ?>" /></td>
812 </tr></table>
813 <table style="text-align: left;">
814 <tr style="text-align: left;">
815 <td style="width: 100%;">
816 <input type="hidden" name="act" value="userinfo" style="display: none;" />
817 <input type="hidden" name="update" value="now" style="display: none;" />
818 <input type="submit" class="Button" value="Save" />
819 <input class="Button" type="reset" />
820 </td></tr></table>
821 </form></td>
822 </tr>
823 <tr id="ProfileEnd" class="TableMenuRow4">
824 <td class="TableMenuColumn4">&nbsp;</td>
825 </tr>
826 </table>
827 </div>
828 <?php @mysql_free_result($result); }
829 if($_POST['update']=="now") {
830 if($_POST['act']=="userinfo"&&
831         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
832         $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
833         $result=mysql_query($query);
834         $num=mysql_num_rows($result);
835         $i=0;
836         $OldPassword=mysql_result($result,$i,"Password");
837         $OldHashType=mysql_result($result,$i,"HashType");
838         $OldJoined=mysql_result($result,$i,"Joined");
839         $OldSalt=mysql_result($result,$i,"Salt");
840         $UpdateHash = false; $NewSalt = salt_hmac(); 
841 if($OldHashType=="ODFH") { 
842         $YourPassword = sha1(md5($_POST['OldPass']));
843         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
844 if($OldHashType=="DF4H") { 
845         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
846         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
847 if($OldHashType=="iDBH"&&$UpdateHash!==true) { 
848         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
849         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
850 if($YourPassword!=$OldPassword) { $Error="Yes"; ?>
851 <div class="TableMessage" style="text-align: center;">Your old Password did not match.<br />&nbsp;</div>
852 <?php } if(pre_strlen($_POST['Password'])=="30") { $Error="Yes"; ?>
853 <div class="TableMessage" style="text-align: center;">Your password is too big.<br />&nbsp;</div>
854 <?php } if(pre_strlen($_POST['OldPass'])=="30") { $Error="Yes"; ?>
855 <div class="TableMessage" style="text-align: center;">Your old password is too big.<br />&nbsp;</div>
856 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
857 <div class="TableMessage" style="text-align: center;">Your passwords did not match.<br />&nbsp;</div>
858 <?php }
859         $NewDay=GMTimeStamp();
860         $NewIP=$_SERVER['REMOTE_ADDR'];
861         if ($Error!="Yes") { $_SESSION['UserPass']=$NewPassword;
862         if($cookieDomain==null) {
863         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir); }
864         if($cookieDomain!=null) {
865         if($cookieSecure===true) {
866         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
867         if($cookieSecure===false) {
868         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain); } }
869         $_POST['Email'] = @remove_spaces($_POST['Email']);
870         $querynewuserinfo = query("UPDATE `".$Settings['sqltable']."members` SET `Password`='%s',`HashType`='iDBH',`Email`='%s',`LastActive`=%i,`IP`='%s',`Salt`='%s' WHERE `id`=%i", array($NewPassword,$_POST['Email'],$NewDay,$NewIP,$NewSalt,$_SESSION['UserID']));
871         mysql_query($querynewuserinfo); } } } }
872 ?>
873 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
874         $profiletitle = " ".$ThemeSet['TitleDivider']." Updating Settings"; ?>
875 </td></tr>
876 <tr id="ProfileTitleEnd" class="TableMenuRow4">
877 <td class="TableMenuColumn4">&nbsp;</td>
878 </tr></table></div><?php } ?>
879 </td></tr>
880 </table>
881 <div class="DivProfile">&nbsp;</div>