OSDN Git Service

Small bug fix. :P
[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: 03/12/2008 SVN 153 - 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 <table class="Table3">
29 <tr style="width: 100%; vertical-align: top;">
30         <td style="width: 15%; vertical-align: top;">
31         <table id="ProfileLinks" class="Table1" style="width: 100%; float: left; vertical-align: top;">
32 <tr class="TableRow1">
33 <td class="TableRow1"><?php echo $ThemeSet['TitleIcon'] ?>Profile Settings</td>
34 </tr><tr class="TableRow2">
35 <td class="TableRow2">&nbsp;</td>
36 </tr><tr class="TableRow3">
37 <td class="TableRow3"><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>
38 </tr><tr class="TableRow3">
39 <td class="TableRow3"><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>
40 </tr><tr class="TableRow3">
41 <td class="TableRow3"><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>
42 </tr><tr class="TableRow3">
43 <td class="TableRow3"><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>
44 </tr><tr class="TableRow4">
45 <td class="TableRow4">&nbsp;</td>
46 </tr></table><div>&nbsp;</div>
47 <table class="Table1" style="width: 100%; float: left; vertical-align: top;">
48 <tr class="TableRow1">
49 <td class="TableRow1"><?php echo $ThemeSet['TitleIcon'] ?>Board Settings</td>
50 </tr><tr class="TableRow2">
51 <td class="TableRow2">&nbsp;</td>
52 </tr><tr class="TableRow3">
53 <td class="TableRow3"><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>
54 </tr><tr class="TableRow3">
55 <td class="TableRow3"><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>
56 </tr><tr class="TableRow4">
57 <td class="TableRow4">&nbsp;</td>
58 </tr></table>
59 </td>
60         <td style="width: 85%; vertical-align: top;">
61 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
62 $updateact = url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
63 $profiletitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
64 @redirect("refresh",$basedir.url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile'],FALSE),"3");
65 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
66 $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
67 ?>
68 <div class="Table1Border">
69 <table class="Table1" style="width: 100%;">
70 <tr class="TableRow1">
71 <td class="TableRow1"><span style="float: left;">
72 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $updateact; ?>">Updating Settings</a>
73 </span><span style="float: right;">&nbsp;</span></td>
74 </tr>
75 <tr id="ProfileTitle" class="TableRow2">
76 <th class="TableRow2">Updating Settings</th>
77 </tr>
78 <tr class="TableRow3" id="ProfileUpdate">
79 <td class="TableRow3">
80 <div style="text-align: center;">
81 <br />Profile updated <a href="<?php echo $updateact; ?>">click here</a> to go back. ^_^<br />&nbsp;</div>
82 <?php } if($_GET['act']=="view") {
83 if($_POST['update']!="now") {
84 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
85 $result=mysql_query($query);
86 $num=mysql_num_rows($result);
87 $i=0;
88 $YourID=mysql_result($result,$i,"id");
89 $Notes=mysql_result($result,$i,"Notes");
90 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
91 $notepadact = $noteact; $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
92 ?>
93 <div class="Table1Border">
94 <table class="Table1" style="width: 100%;">
95 <tr class="TableRow1">
96 <td class="TableRow1"><span style="float: left;">
97 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $noteact; ?>">NotePad</a>
98 </span><span style="float: right;">&nbsp;</span></td>
99 </tr>
100 <tr id="ProfileTitle" class="TableRow2">
101 <th class="TableRow2">NotePad</th>
102 </tr>
103 <tr class="TableRow3" id="NotePadRow">
104 <td class="TableRow3">
105 <form style="display: inline;" method="post" action="<?php echo $notepadact; ?>"><div style="text-align: center;">
106 <label class="TextBoxLabel" for="NotePad">Your NotePad</label><br />
107 <textarea class="TextBox" name="NotePad" id="NotePad" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Notes; ?></textarea>
108 <input type="hidden" name="act" value="view" style="display: none;" />
109 <input type="hidden" name="update" value="now" style="display: none;" />
110 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
111 </div></form></td>
112 </tr>
113 <tr id="ProfileEnd" class="TableRow4">
114 <td class="TableRow4">&nbsp;</td>
115 </tr>
116 </table>
117 </div>
118 <?php @mysql_free_result($result); }
119 if($_POST['update']=="now") {
120 if($_POST['act']=="view"&&
121         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
122         $_POST['NotePad'] = htmlspecialchars($_POST['NotePad'], ENT_QUOTES, $Settings['charset']);
123         $_POST['NotePad'] = remove_bad_entities($_POST['NotePad']);
124         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
125         //$_POST['Signature'] = @remove_spaces($_POST['Signature']);
126         //$_POST['Signature'] = remove_bad_entities($_POST['Signature']);
127         /*    <_<  iWordFilter  >_>      
128     by René Johnson - Cool Dude 2k */
129         $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
130         $katarzynart=mysql_query($katarzynaqy);
131         $katarzynanm=mysql_num_rows($katarzynart);
132         $katarzynas=0;
133         while ($katarzynas < $katarzynanm) {
134         $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
135         $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
136         $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
137         if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
138         if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
139         if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
140         $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
141         if($WholeWord=="on") { $WholeWord = "yes"; }
142         if($WholeWord=="off") { $WholeWord = "no"; }
143         if($WholeWord!="yes"||$WholeWord!="no") { $WholeWord = "no"; }
144         $Filter = preg_quote($Filter, "/");
145         if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
146         $_POST['NotePad'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['NotePad']); }
147         if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
148         $_POST['NotePad'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['NotePad']); }
149         if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
150         $_POST['NotePad'] = preg_replace("/".$Filter."/", $Replace, $_POST['NotePad']); }
151         if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
152         $_POST['NotePad'] = preg_replace("/".$Filter."/i", $Replace, $_POST['NotePad']); }
153         ++$katarzynas; } @mysql_free_result($katarzynart);
154         $NewDay=GMTimeStamp();
155         $NewIP=$_SERVER['REMOTE_ADDR'];
156         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `Notes`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['NotePad'],$NewDay,$NewIP,$_SESSION['UserID']));
157                 mysql_query($querynewskin); } } }
158 if($_GET['act']=="signature") {
159 if($_POST['update']!="now") {
160 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
161 $result=mysql_query($query);
162 $num=mysql_num_rows($result);
163 $i=0;
164 $YourID=mysql_result($result,$i,"id");
165 $Signature=mysql_result($result,$i,"Signature"); 
166 $signatureact = url_maker($exfile['profile'],$Settings['file_ext'],"act=signature",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
167 $profiletitle = " ".$ThemeSet['TitleDivider']." Signature Editor";
168 ?>
169 <div class="Table1Border">
170 <table class="Table1" style="width: 100%;">
171 <tr class="TableRow1">
172 <td class="TableRow1"><span style="float: left;">
173 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $signatureact; ?>">Signature Editer</a>
174 </span><span style="float: right;">&nbsp;</span></td>
175 </tr>
176 <tr id="ProfileTitle" class="TableRow2">
177 <th class="TableRow2">Signature Editor</th>
178 </tr>
179 <tr class="TableRow3" id="SignatureRow">
180 <td class="TableRow3">
181 <form style="display: inline;" method="post" action="<?php echo $signatureact; ?>"><div style="text-align: center;">
182 <label class="TextBoxLabel" for="Signature">Your Signature</label><br />
183 <textarea class="TextBox" name="Signature" id="Signature" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Signature; ?></textarea>
184 <input type="hidden" name="act" value="signature" style="display: none;" />
185 <input type="hidden" name="update" value="now" style="display: none;" />
186 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
187 </div></form></td>
188 </tr>
189 <tr id="ProfileEnd" class="TableRow4">
190 <td class="TableRow4">&nbsp;</td>
191 </tr>
192 </table>
193 </div>
194 <?php @mysql_free_result($result); }
195 if($_POST['update']=="now") {
196 if($_POST['act']=="signature"&&
197         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
198         $_POST['Signature'] = stripcslashes(htmlspecialchars($_POST['Signature'], ENT_QUOTES));
199         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
200         //$_POST['Signature'] = @remove_spaces($_POST['Signature']);
201         $_POST['Signature'] = remove_bad_entities($_POST['Signature']);
202         /*    <_<  iWordFilter  >_>      
203     by René Johnson - Cool Dude 2k */
204         $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
205         $katarzynart=mysql_query($katarzynaqy);
206         $katarzynanm=mysql_num_rows($katarzynart);
207         $katarzynas=0;
208         while ($katarzynas < $katarzynanm) {
209         $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
210         $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
211         $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
212         if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
213         if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
214         if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
215         $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
216         if($WholeWord=="on") { $WholeWord = "yes"; }
217         if($WholeWord=="off") { $WholeWord = "no"; }
218         if($WholeWord!="yes"||$WholeWord!="no") { $WholeWord = "no"; }
219         $Filter = preg_quote($Filter, "/");
220         if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
221         $_POST['Signature'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['Signature']); }
222         if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
223         $_POST['Signature'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['Signature']); }
224         if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
225         $_POST['Signature'] = preg_replace("/".$Filter."/", $Replace, $_POST['Signature']); }
226         if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
227         $_POST['Signature'] = preg_replace("/".$Filter."/i", $Replace, $_POST['Signature']); }
228         ++$katarzynas; } @mysql_free_result($katarzynart);
229         $NewDay=GMTimeStamp();
230         $NewIP=$_SERVER['REMOTE_ADDR'];
231         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `Signature`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['Signature'],$NewDay,$NewIP,$_SESSION['UserID']));
232         mysql_query($querynewskin); } } }
233 if($_GET['act']=="avatar") {
234 if($_POST['update']!="now") {
235 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
236 $result=mysql_query($query);
237 $num=mysql_num_rows($result);
238 $i=0;
239 $YourID=mysql_result($result,$i,"id");
240 $User1Avatar=mysql_result($result,$i,"Avatar"); 
241 $User1AvatarSize=mysql_result($result,$i,"AvatarSize");
242 $avataract = url_maker($exfile['profile'],$Settings['file_ext'],"act=avatar",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
243 $profiletitle = " ".$ThemeSet['TitleDivider']." Avatar Editor";
244 $Pre1Avatar = $User1Avatar;
245 if ($User1Avatar==null) { $User1Avatar="http://"; }
246 if ($Pre1Avatar=="http://"||$Pre1Avatar==null||
247         strtolower($Pre1Avatar)=="noavatar") {
248 $Pre1Avatar=$ThemeSet['NoAvatar'];
249 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
250 $AvatarSize1=explode("x", $User1AvatarSize);
251 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
252 ?>
253 <div class="Table1Border">
254 <table class="Table1" style="width: 100%;">
255 <tr class="TableRow1">
256 <td class="TableRow1"><span style="float: left;">
257 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $avataract; ?>">Avatar Editer</a>
258 </span><span style="float: right;">&nbsp;</span></td>
259 </tr>
260 <tr id="ProfileTitle" class="TableRow2">
261 <th class="TableRow2">Avatar Editor</th>
262 </tr>
263 <tr class="TableRow3" id="AvatarEditor">
264 <td class="TableRow3">
265 <form style="display: inline;" method="post" action="<?php echo $avataract; ?>">
266  <?php  /* Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/ */  ?>
267  <table class="AvatarTable" style="width: 100px; height: 100px; text-align: center;">
268         <tr class="AvatarRow" style="width: 100%; height: 100%;">
269                 <td class="AvatarRow" style="width: 100%; height: 100%; text-align: center; vertical-align: middle;">
270                 <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;" />
271                 </td>
272         </tr>
273  </table>
274 <table style="text-align: left;">
275 <tr style="text-align: left;">
276         <td style="width: 40%;"><label class="TextBoxLabel" for="Avatar">Your Avatar</label></td>
277         <td style="width: 60%;"><input type="text" class="TextBox" name="Avatar" id="Avatar" value="<?php echo $User1Avatar; ?>" size="20" /></td>
278         </tr><tr style="text-align: left;">
279         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeW">Avatar Width</label></td>
280         <td style="width: 60%;"><select size="1" name="AvatarSizeW" id="AvatarSizeW" class="TextBox">
281         <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; } ?>
282 </select></td>
283 </tr><tr style="text-align: left;">
284         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeH">Avatar Height</label></td>
285         <td style="width: 60%;"><select size="1" name="AvatarSizeH" id="AvatarSizeH" class="TextBox">
286 <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; } ?>
287 </select></td>
288 </tr></table>
289 <table style="text-align: left;">
290 <tr style="text-align: left;">
291 <td style="width: 100%;">
292 <input type="hidden" name="act" value="avatar" style="display: none;" />
293 <input type="hidden" name="update" value="now" style="display: none;" />
294 <input type="submit" class="Button" value="Save" />
295 <input class="Button" type="reset" />
296 </td></tr></table>
297 </form></td>
298 </tr>
299 <tr id="ProfileEnd" class="TableRow4">
300 <td class="TableRow4">&nbsp;</td>
301 </tr>
302 </table>
303 </div>
304 <?php @mysql_free_result($result); }
305 if($_POST['update']=="now") {
306 if($_POST['Avatar']!=null&&$_POST['AvatarSizeW']!=null&&$_POST['AvatarSizeH']!=null&&
307         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
308         if($_POST['AvatarSizeW']>=100) { $_POST['AvatarSizeW']=100; }
309         if($_POST['AvatarSizeH']>=100) { $_POST['AvatarSizeH']=100; }
310         $fullavatarsize = $_POST['AvatarSizeW']."x".$_POST['AvatarSizeH'];
311         $_POST['Avatar'] = htmlentities($_POST['Avatar'], ENT_QUOTES, $Settings['charset']);
312         $NewDay=GMTimeStamp();
313         $NewIP=$_SERVER['REMOTE_ADDR'];
314         $_POST['Avatar'] = @remove_spaces($_POST['Avatar']);
315         $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']));
316         mysql_query($querynewskin); } } }
317 if($_GET['act']=="settings") {
318 if($_POST['update']!="now") {
319 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
320 $result=mysql_query($query);
321 $num=mysql_num_rows($result);
322 $i=0;
323 $YourID=mysql_result($result,$i,"id");
324 $User1TimeZone=mysql_result($result,$i,"TimeZone"); 
325 $tsa_mem = explode(":",$User1TimeZone);
326 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
327 $User1DST=mysql_result($result,$i,"DST");
328 $settingsact = url_maker($exfile['profile'],$Settings['file_ext'],"act=settings",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
329 $profiletitle = " ".$ThemeSet['TitleDivider']." Board Settings"; ?>
330 <div class="Table1Border">
331 <table class="Table1" style="width: 100%;">
332 <tr class="TableRow1">
333 <td class="TableRow1"><span style="float: left;">
334 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $settingsact; ?>">Board Settings</a>
335 </span><span style="float: right;">&nbsp;</span></td>
336 </tr>
337 <tr id="ProfileTitle" class="TableRow2">
338 <th class="TableRow2">Board Settings</th>
339 </tr>
340 <tr class="TableRow3" id="BoardSettings">
341 <td class="TableRow3">
342 <form style="display: inline;" method="post" action="<?php echo $settingsact; ?>">
343 <table style="text-align: left;">
344 <tr style="text-align: left;">
345         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
346         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
347 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
348 <?php
349 $plusi = 1; $minusi = 12;
350 $plusnum = 13; $minusnum = 0;
351 while ($minusi > $minusnum) {
352 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
353 --$minusi; }
354 ?>
355 <option value="0">GMT +/- 0:00 hours</option>
356 <?php
357 while ($plusi < $plusnum) {
358 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
359 ++$plusi; }
360 ?></select></td>
361 </tr><tr style="text-align: left;">
362         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
363         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
364 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
365 <?php
366 $mini = 0; $minnum = 60;
367 while ($mini < $minnum) {
368 if(pre_strlen($mini)==2) { $showmin = $mini; }
369 if(pre_strlen($mini)==1) { $showmin = "0".$mini; }
370 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
371 ++$mini; }
372 ?></select></td>
373 </tr><tr style="text-align: left;">
374         <td style="width: 40%;"><label class="TextBoxLabel" for="skin">Pick a CSS Theme</label></td>
375         <td style="width: 60%;"><select id="skin" name="skin" class="TextBox">
376 <option selected="selected" value="<?php echo $_SESSION['Theme']; ?>">Old Value (<?php echo $_SESSION['Theme']; ?>)</option><?php
377 $skindir = dirname(realpath("settings.php"))."/".$SettDir['themes'];
378 if ($handle = opendir($skindir)) { $dirnum = null;
379    while (false !== ($file = readdir($handle))) {
380            if ($dirnum==null) { $dirnum = 0; }
381            if (file_exists($skindir.$file."/info.php")) {
382                    if ($file != "." && $file != "..") {
383            include($skindir.$file."/info.php");
384        $themelist[$dirnum] =  "<option value=\"".$file."\">".$ThemeInfo['ThemeName']."</option>";
385            ++$dirnum; } } }
386    closedir($handle); asort($themelist);
387    $themenum=count($themelist); $themei=0; 
388    while ($themei < $themenum) {
389    echo $themelist[$themei]."\n";
390    ++$themei; }
391 } ?></select></td>
392 </tr><tr style="text-align: left;">
393         <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>
394         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
395 <?php if($User1DST=="off"||$User1DST!="on") { ?>
396 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
397 <?php } if($User1DST=="on") { ?>
398 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
399 <?php } echo "\n" ?></select></td>
400 </tr></table>
401 <table style="text-align: left;">
402 <tr style="text-align: left;">
403 <td style="width: 100%;">
404 <input type="hidden" name="act" value="settings" style="display: none;" />
405 <input type="hidden" name="update" value="now" style="display: none;" />
406 <input type="submit" class="Button" value="Save" />
407 <input class="Button" type="reset" />
408 </td></tr></table>
409 </form></td>
410 </tr>
411 <tr id="ProfileEnd" class="TableRow4">
412 <td class="TableRow4">&nbsp;</td>
413 </tr>
414 </table>
415 </div>
416 <?php @mysql_free_result($result); }
417 if($_POST['update']=="now") {
418 if($_POST['act']=="settings"&&
419         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
420         $NewDay=GMTimeStamp();
421         $NewIP=$_SERVER['REMOTE_ADDR'];
422         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
423         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
424         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
425         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
426         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
427         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
428         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
429         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
430         $_SESSION['UserDST'] = $_POST['DST'];
431         $querynewskin = query("UPDATE `".$Settings['sqltable']."members` SET `UseTheme`='%s',`TimeZone`='%s',`DST`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['skin'],$_POST['YourOffSet'],$_POST['DST'],$NewDay,$NewIP,$_SESSION['UserID']));
432         mysql_query($querynewskin); } } }
433 if($_GET['act']=="profile") {
434 if($_POST['update']!="now") {
435 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
436 $result=mysql_query($query);
437 $num=mysql_num_rows($result);
438 $i=0;
439 $YourID=mysql_result($result,$i,"id");
440 $User1Interests=mysql_result($result,$i,"Interests"); 
441 $User1Title=mysql_result($result,$i,"Title");
442 $User1Website=mysql_result($result,$i,"Website"); 
443 $User1Gender=mysql_result($result,$i,"Gender");
444 $User1TimeZone=mysql_result($result,$i,"TimeZone");
445 $BirthDay=mysql_result($result,$i,"BirthDay");
446 $BirthMonth=mysql_result($result,$i,"BirthMonth");
447 $BirthYear=mysql_result($result,$i,"BirthYear");
448 $User1Birthday = "MM/DD/YYYY";
449 if($BirthMonth!=null&&$BirthDay!=null&&$BirthYear!=null) { 
450         if($BirthYear=="0") { $BirthYear = "YYYY"; }
451         if($BirthDay=="0") { $BirthDay = "DD"; }
452         if($BirthMonth=="0") { $BirthMonth = "MM"; }
453         if(pre_strlen($BirthMonth)=="1") { $BirthMonth = "0".$BirthMonth; }
454         if(pre_strlen($BirthDay)=="1") { $BirthDay = "0".$BirthDay; }
455     if($BirthYear!="MM"&&$BirthYear!="DD"&&$BirthYear!="YYYY"&&
456         checkdate($BirthMonth,$BirthDay,$BirthYear)==false) {
457         $BirthMonth = "MM"; $BirthDay = "DD"; $BirthYear = "YYYY"; }
458         $User1Birthday = $BirthMonth."/".$BirthDay."/".$BirthYear; }
459 $tsa_mem = explode(":",$User1TimeZone);
460 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
461 $User1DST=mysql_result($result,$i,"DST");
462 $profileact = url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
463 $profiletitle = " ".$ThemeSet['TitleDivider']." Profile Editor";
464 ?>
465 <div class="Table1Border">
466 <table class="Table1" style="width: 100%;">
467 <tr class="TableRow1">
468 <td class="TableRow1"><span style="float: left;">
469 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
470 </span><span style="float: right;">&nbsp;</span></td>
471 </tr>
472 <tr id="ProfileTitle" class="TableRow2">
473 <th class="TableRow2">Profile Editor</th>
474 </tr>
475 <tr class="TableRow3" id="ProfileEditor">
476 <td class="TableRow3">
477 <form style="display: inline;" method="post" action="<?php echo $profileact; ?>">
478 <table style="text-align: left;">
479 <tr style="text-align: left;">
480         <td style="width: 40%;"><label class="TextBoxLabel" for="Interests">Your Interests</label></td>
481         <td style="width: 60%;"><input type="text" class="TextBox" name="Interests" id="Interests" value="<?php echo $User1Interests; ?>" /></td>
482 </tr><tr style="text-align: left;">
483         <td style="width: 40%;"><label class="TextBoxLabel" for="Title">Your Title</label></td>
484         <td style="width: 60%;"><input type="text" class="TextBox" name="Title" id="Title" value="<?php echo $User1Title; ?>" /></td>
485 </tr><tr style="text-align: left;">
486         <td style="width: 40%;"><label class="TextBoxLabel" for="Website">Your Website</label></td>
487         <td style="width: 60%;"><input type="text" class="TextBox" name="Website" id="Website" value="<?php echo $User1Website; ?>" /></td>
488 </tr><tr style="text-align: left;">
489         <td style="width: 40%;"><label class="TextBoxLabel" for="EventDay">Your Birthday</label></td>
490         <td style="width: 60%;"><input maxlength="10" type="text" class="TextBox" name="EventDay" id="EventDay" value="<?php echo $User1Birthday; ?>" /></td>
491 </tr><tr style="text-align: left;">
492         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
493         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
494 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
495 <?php
496 $plusi = 1; $minusi = 12;
497 $plusnum = 13; $minusnum = 0;
498 while ($minusi > $minusnum) {
499 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
500 --$minusi; }
501 ?>
502 <option value="0">GMT +/- 0:00 hours</option>
503 <?php
504 while ($plusi < $plusnum) {
505 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
506 ++$plusi; }
507 ?></select></td>
508 </tr><tr style="text-align: left;">
509         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
510         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
511 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
512 <?php
513 $mini = 0; $minnum = 60;
514 while ($mini < $minnum) {
515 if(pre_strlen($mini)==2) { $showmin = $mini; }
516 if(pre_strlen($mini)==1) { $showmin = "0".$mini; }
517 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
518 ++$mini; }
519 ?></select></td>
520 </tr><tr style="text-align: left;">
521         <td style="width: 40%;"><label class="TextBoxLabel" for="YourGender">Your Gender:</label></td>
522         <td style="width: 60%;"><select id="YourGender" name="YourGender" class="TextBox">
523 <option selected="selected" value="<?php echo $User1Gender; ?>">Old Value (<?php echo $User1Gender; ?>)</option>
524 <option value="Male">Male</option>
525 <option value="Female">Female</option>
526 <option value="Unknow">Unknow</option>
527 </select></td>
528 </tr><tr style="text-align: left;">
529         <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>
530         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
531 <?php if($User1DST=="off"||$User1DST!="on") { ?>
532 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
533 <?php } if($User1DST=="on") { ?>
534 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
535 <?php } echo "\n" ?></select></td>
536 </tr></table>
537 <table style="text-align: left;">
538 <tr style="text-align: left;">
539 <td style="width: 100%;">
540 <input type="hidden" name="act" value="profile" style="display: none;" />
541 <input type="hidden" name="update" value="now" style="display: none;" />
542 <input type="submit" class="Button" value="Save" />
543 <input class="Button" type="reset" />
544 </td></tr></table>
545 </form></td>
546 </tr>
547 <tr id="ProfileEnd" class="TableRow4">
548 <td class="TableRow4">&nbsp;</td>
549 </tr>
550 </table>
551 </div>
552 <?php @mysql_free_result($result); }
553 if($_POST['update']=="now") {
554 if($_POST['act']=="profile"&&
555         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
556         $_POST['Interests'] = htmlspecialchars($_POST['Interests'], ENT_QUOTES, $Settings['charset']);
557         $_POST['Interests'] = @remove_spaces($_POST['Interests']);
558         $_POST['Title'] = htmlspecialchars($_POST['Title'], ENT_QUOTES, $Settings['charset']);
559         $_POST['Title'] = @remove_spaces($_POST['Title']);
560         $_POST['Website'] = htmlentities($_POST['Website'], ENT_QUOTES, $Settings['charset']);
561         $_POST['Website'] = @remove_spaces($_POST['Website']);
562         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
563         //$_POST['Signature'] = @remove_spaces($_POST['Signature']);
564         //$_POST['Signature'] = remove_bad_entities($_POST['Signature']);
565         /*    <_<  iWordFilter  >_>      
566     by René Johnson - Cool Dude 2k */
567         $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
568         $katarzynart=mysql_query($katarzynaqy);
569         $katarzynanm=mysql_num_rows($katarzynart);
570         $katarzynas=0;
571         while ($katarzynas < $katarzynanm) {
572         $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
573         $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
574         $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
575         if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
576         if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
577         if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
578         $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
579         if($WholeWord=="on") { $WholeWord = "yes"; }
580         if($WholeWord=="off") { $WholeWord = "no"; }
581         if($WholeWord!="yes"||$WholeWord!="no") { $WholeWord = "no"; }
582         $Filter = preg_quote($Filter, "/");
583         if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
584         $_POST['Interests'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['Interests']);
585         $_POST['Title'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['Title']); }
586         if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
587         $_POST['Interests'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['Interests']);
588         $_POST['Title'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['Title']); }
589         if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
590         $_POST['Interests'] = preg_replace("/".$Filter."/", $Replace, $_POST['Interests']);
591         $_POST['Title'] = preg_replace("/".$Filter."/", $Replace, $_POST['Title']); }
592         if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
593         $_POST['Interests'] = preg_replace("/".$Filter."/i", $Replace, $_POST['Interests']); 
594         $_POST['Title'] = preg_replace("/".$Filter."/i", $Replace, $_POST['Title']); }
595         ++$katarzynas; } @mysql_free_result($katarzynart);
596         if(!isset($_POST['EventDay'])) { $_POST['EventDay'] = null; }
597         if($_POST['EventDay']!=null) {
598         $BirthExpl = explode("/",$_POST['EventDay']);
599         if(count($BirthExpl)=="3"&&checkdate($BirthExpl[0],$BirthExpl[1],$BirthExpl[2])==true) {
600         if(is_numeric($BirthExpl[0])&&is_numeric($BirthExpl[1])&&is_numeric($BirthExpl[2])) {
601         if(pre_strlen($BirthExpl[0])=="1") { $BirthExpl[0] = "0".$BirthExpl[0]; }
602         if(pre_strlen($BirthExpl[1])=="1") { $BirthExpl[1] = "0".$BirthExpl[1]; }
603         if(pre_strlen($BirthExpl[0])=="2"&&pre_strlen($BirthExpl[1])=="2"&&pre_strlen($BirthExpl[2])=="4") {
604         $BirthIn = mktime(12,12,12,$BirthExpl[0],$BirthExpl[1],$BirthExpl[2]);
605         $BirthMonth=GMTimeChange("m",$BirthIn,0,0,"off");
606         $BirthDay=GMTimeChange("d",$BirthIn,0,0,"off");
607         $BirthYear=GMTimeChange("Y",$BirthIn,0,0,"off"); }
608         if(pre_strlen($BirthExpl[0])!="2"||pre_strlen($BirthExpl[1])!="2"||pre_strlen($BirthExpl[2])!="4") { 
609                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
610         if (!is_numeric($BirthExpl[0])||!is_numeric($BirthExpl[1])||!is_numeric($BirthExpl[2])) { 
611                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
612         if(count($BirthExpl)=="3"&&
613         checkdate($BirthExpl[0],$BirthExpl[1],$BirthExpl[2])==false) {
614         $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
615         if(count($BirthExpl)!="3") { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
616         if($_POST['EventDay']==null) { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
617         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
618         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
619         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
620         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
621         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
622         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
623         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
624         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
625         $_SESSION['UserDST'] = $_POST['DST'];
626         $NewDay=GMTimeStamp();
627         $NewIP=$_SERVER['REMOTE_ADDR'];
628         $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,`IP`='%s' WHERE `id`=%i", array($_POST['Interests'],$_POST['Title'],$_POST['Website'],$_POST['YourOffSet'],$_POST['YourGender'],$_POST['DST'],$NewDay,$BirthMonth,$BirthDay,$BirthYear,$NewIP,$_SESSION['UserID']));
629         mysql_query($querynewprofile); } } }
630 if($_GET['act']=="userinfo") {
631 if($_POST['update']!="now") {
632 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
633 $result=mysql_query($query);
634 $num=mysql_num_rows($result);
635 $i=0;
636 $YourID=mysql_result($result,$i,"id");
637 $User1Email=mysql_result($result,$i,"Email"); 
638 $userinfoact = url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
639 $profiletitle = " ".$ThemeSet['TitleDivider']." User Info Editer";
640 ?>
641 <div class="Table1Border">
642 <table class="Table1" style="width: 100%;">
643 <tr class="TableRow1">
644 <td class="TableRow1"><span style="float: left;">
645 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
646 </span><span style="float: right;">&nbsp;</span></td>
647 </tr>
648 <tr id="ProfileTitle" class="TableRow2">
649 <th class="TableRow2">User Info Editer</th>
650 </tr>
651 <tr class="TableRow3" id="UserInfoEditor">
652 <td class="TableRow3">
653 <form style="display: inline;" method="post" action="<?php echo $userinfoact; ?>">
654 <table style="text-align: left;">
655 <tr style="text-align: left;">
656         <td style="width: 40%;"><label class="TextBoxLabel" for="OldPass">Insert old Password:</label></td>
657         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="OldPass" size="20" id="OldPass" /></td>
658 </tr><tr style="text-align: left;">
659         <td style="width: 40%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
660         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="Password" size="20" id="Password" /></td>
661 </tr><tr style="text-align: left;">
662         <td style="width: 40%;"><label class="TextBoxLabel" for="RePassword">ReInsert a Password:</label></td>
663         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="RePassword" size="20" id="RePassword" /></td>
664 </tr><tr style="text-align: left;">
665         <td style="width: 40%;"><label class="TextBoxLabel" for="Email">Insert Your Email:</label></td>
666         <td style="width: 60%;"><input type="text" class="TextBox" name="Email" size="20" id="Email" value="<?php echo $User1Email; ?>" /></td>
667 </tr></table>
668 <table style="text-align: left;">
669 <tr style="text-align: left;">
670 <td style="width: 100%;">
671 <input type="hidden" name="act" value="userinfo" style="display: none;" />
672 <input type="hidden" name="update" value="now" style="display: none;" />
673 <input type="submit" class="Button" value="Save" />
674 <input class="Button" type="reset" />
675 </td></tr></table>
676 </form></td>
677 </tr>
678 <tr id="ProfileEnd" class="TableRow4">
679 <td class="TableRow4">&nbsp;</td>
680 </tr>
681 </table>
682 </div>
683 <?php @mysql_free_result($result); }
684 if($_POST['update']=="now") {
685 if($_POST['act']=="userinfo"&&
686         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
687         $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
688         $result=mysql_query($query);
689         $num=mysql_num_rows($result);
690         $i=0;
691         $OldPassword=mysql_result($result,$i,"Password");
692         $OldHashType=mysql_result($result,$i,"HashType");
693         $OldJoined=mysql_result($result,$i,"Joined");
694         $OldSalt=mysql_result($result,$i,"Salt");
695         $UpdateHash = false; $NewSalt = salt_hmac(); 
696 if($OldHashType=="ODFH") { 
697         $YourPassword = sha1(md5($_POST['OldPass']));
698         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
699 if($OldHashType=="DF4H") { 
700         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
701         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
702 if($OldHashType=="iDBH"&&$UpdateHash!=true) { 
703         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
704         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
705 if($YourPassword!=$OldPassword) { $Error="Yes"; ?>
706 <div class="TableMessage" style="text-align: center;">Your old Password did not match.<br />&nbsp;</div>
707 <?php } if(pre_strlen($_POST['Password'])=="30") { $Error="Yes"; ?>
708 <div class="TableMessage" style="text-align: center;">Your password is too big.<br />&nbsp;</div>
709 <?php } if(pre_strlen($_POST['OldPass'])=="30") { $Error="Yes"; ?>
710 <div class="TableMessage" style="text-align: center;">Your old password is too big.<br />&nbsp;</div>
711 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
712 <div class="TableMessage" style="text-align: center;">Your passwords did not match.<br />&nbsp;</div>
713 <?php }
714         $NewDay=GMTimeStamp();
715         $NewIP=$_SERVER['REMOTE_ADDR'];
716         if ($Error!="Yes") { $_SESSION['UserPass']=$NewPassword;
717         if($cookieDomain==null) {
718         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir); }
719         if($cookieDomain!=null) {
720         if($cookieSecure==true) {
721         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
722         if($cookieSecure==false) {
723         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain); } }
724         $_POST['Email'] = @remove_spaces($_POST['Email']);
725         $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']));
726         mysql_query($querynewuserinfo); } } } }
727 ?>
728 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
729         $profiletitle = " ".$ThemeSet['TitleDivider']." Updating Settings"; ?>
730 </td></tr>
731 <tr id="ProfileTitleEnd" class="TableRow4">
732 <td class="TableRow4">&nbsp;</td>
733 </tr></table></div><?php } ?>
734 </td></tr>
735 </table>
736 <div>&nbsp;</div>