OSDN Git Service

Small bug fix. (Some thanks at Jcink for helping)
[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-2007 Cool Dude 2k - http://intdb.sourceforge.net/
12     Copyright 2004-2007 Game Maker 2k - http://upload.idb.s1.jcink.com/
13
14     $FileInfo: profilemain.php - Last Update: 08/05/2007 SVN 68 - 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 = " - 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 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'] = htmlentities($_POST['NotePad'], ENT_QUOTES);
123         $_POST['NotePad'] = remove_bad_entities($_POST['NotePad']);
124         $NewDay=GMTimeStamp();
125         $NewIP=$_SERVER['REMOTE_ADDR'];
126         $querynewskin = query("update `".$Settings['sqltable']."members` set `Notes`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['NotePad'],$NewDay,$NewIP,$_SESSION['UserID']));
127                 mysql_query($querynewskin); } } }
128 if($_GET['act']=="signature") {
129 if($_POST['update']!="now") {
130 $query = query("select * from `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
131 $result=mysql_query($query);
132 $num=mysql_num_rows($result);
133 $i=0;
134 $YourID=mysql_result($result,$i,"id");
135 $Signature=mysql_result($result,$i,"Signature"); 
136 $signatureact = url_maker($exfile['profile'],$Settings['file_ext'],"act=signature",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
137 $profiletitle = " ".$ThemeSet['TitleDivider']." Signature Editor";
138 ?>
139 <div class="Table1Border">
140 <table class="Table1" style="width: 100%;">
141 <tr class="TableRow1">
142 <td class="TableRow1"><span style="float: left;">
143 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $signatureact; ?>">Signature Editer</a>
144 </span><span style="float: right;">&nbsp;</span></td>
145 </tr>
146 <tr id="ProfileTitle" class="TableRow2">
147 <th class="TableRow2">Signature Editor</th>
148 </tr>
149 <tr class="TableRow3" id="SignatureRow">
150 <td class="TableRow3">
151 <form method="post" action="<?php echo $signatureact; ?>"><div style="text-align: center;">
152 <label class="TextBoxLabel" for="Signature">Your Signature</label><br />
153 <textarea class="TextBox" name="Signature" id="Signature" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Signature; ?></textarea>
154 <input type="hidden" name="act" value="signature" style="display: none;" />
155 <input type="hidden" name="update" value="now" style="display: none;" />
156 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
157 </div></form></td>
158 </tr>
159 <tr id="ProfileEnd" class="TableRow4">
160 <td class="TableRow4">&nbsp;</td>
161 </tr>
162 </table>
163 </div>
164 <?php @mysql_free_result($result); }
165 if($_POST['update']=="now") {
166 if($_POST['act']=="signature"&&
167         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
168         $_POST['Signature'] = htmlentities($_POST['Signature'], ENT_QUOTES);
169         $_POST['Signature'] = preg_replace("/\t+/"," ",$_POST['Signature']);
170         $_POST['Signature'] = preg_replace("/\s\s+/"," ",$_POST['Signature']);
171         $_POST['Signature'] = remove_bad_entities($_POST['Signature']);
172         $NewDay=GMTimeStamp();
173         $NewIP=$_SERVER['REMOTE_ADDR'];
174         $querynewskin = query("update `".$Settings['sqltable']."members` set `Signature`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['Signature'],$NewDay,$NewIP,$_SESSION['UserID']));
175         mysql_query($querynewskin); } } }
176 if($_GET['act']=="avatar") {
177 if($_POST['update']!="now") {
178 $query = query("select * from `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
179 $result=mysql_query($query);
180 $num=mysql_num_rows($result);
181 $i=0;
182 $YourID=mysql_result($result,$i,"id");
183 $User1Avatar=mysql_result($result,$i,"Avatar"); 
184 $User1AvatarSize=mysql_result($result,$i,"AvatarSize");
185 $avataract = url_maker($exfile['profile'],$Settings['file_ext'],"act=avatar",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
186 $profiletitle = " ".$ThemeSet['TitleDivider']." Avatar Editor";
187 $Pre1Avatar = $User1Avatar;
188 if ($User1Avatar==null) { $User1Avatar="http://"; }
189 if ($Pre1Avatar=="http://"||$Pre1Avatar==null) {
190 $Pre1Avatar=$ThemeSet['NoAvatar'];
191 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
192 $AvatarSize1=explode("x", $User1AvatarSize);
193 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
194 ?>
195 <div class="Table1Border">
196 <table class="Table1" style="width: 100%;">
197 <tr class="TableRow1">
198 <td class="TableRow1"><span style="float: left;">
199 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $avataract; ?>">Avatar Editer</a>
200 </span><span style="float: right;">&nbsp;</span></td>
201 </tr>
202 <tr id="ProfileTitle" class="TableRow2">
203 <th class="TableRow2">Avatar Editor</th>
204 </tr>
205 <tr class="TableRow3" id="AvatarEditor">
206 <td class="TableRow3">
207 <form method="post" action="<?php echo $avataract; ?>">
208  <?php  /* Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/ */  ?>
209  <table class="AvatarTable" style="width: 100px; height: 100px; text-align: center;">
210         <tr class="AvatarRow" style="width: 100%; height: 100%;">
211                 <td class="AvatarRow" style="width: 100%; height: 100%; text-align: center; vertical-align: middle;">
212                 <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;" />
213                 </td>
214         </tr>
215  </table>
216 <table style="text-align: left;">
217 <tr style="text-align: left;">
218         <td style="width: 40%;"><label class="TextBoxLabel" for="Avatar">Your Avatar</label></td>
219         <td style="width: 60%;"><input type="text" class="TextBox" name="Avatar" id="Avatar" value="<?php echo $User1Avatar; ?>" size="20" /></td>
220         </tr><tr style="text-align: left;">
221         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeW">Avatar Width</label></td>
222         <td style="width: 60%;"><select size="1" name="AvatarSizeW" id="AvatarSizeW" class="TextBox">
223         <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; } ?>
224 </select></td>
225 </tr><tr style="text-align: left;">
226         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeH">Avatar Height</label></td>
227         <td style="width: 60%;"><select size="1" name="AvatarSizeH" id="AvatarSizeH" class="TextBox">
228 <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; } ?>
229 </select></td>
230 </tr></table>
231 <table style="text-align: left;">
232 <tr style="text-align: left;">
233 <td style="width: 100%;">
234 <input type="hidden" name="act" value="avatar" style="display: none;" />
235 <input type="hidden" name="update" value="now" style="display: none;" />
236 <input type="submit" class="Button" value="Save" />
237 <input class="Button" type="reset" />
238 </td></tr></table>
239 </form></td>
240 </tr>
241 <tr id="ProfileEnd" class="TableRow4">
242 <td class="TableRow4">&nbsp;</td>
243 </tr>
244 </table>
245 </div>
246 <?php @mysql_free_result($result); }
247 if($_POST['update']=="now") {
248 if($_POST['Avatar']!=null&&$_POST['AvatarSizeW']!=null&&$_POST['AvatarSizeH']!=null&&
249         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
250         if($_POST['AvatarSizeW']>=100) { $_POST['AvatarSizeW']=100; }
251         if($_POST['AvatarSizeH']>=100) { $_POST['AvatarSizeH']=100; }
252         $fullavatarsize = $_POST['AvatarSizeW']."x".$_POST['AvatarSizeH'];
253         $_POST['Avatar'] = htmlentities($_POST['Avatar'], ENT_QUOTES);
254         $NewDay=GMTimeStamp();
255         $NewIP=$_SERVER['REMOTE_ADDR'];
256         $_POST['Avatar'] = @remove_spaces($_POST['Avatar']);
257         $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']));
258         mysql_query($querynewskin); } } }
259 if($_GET['act']=="settings") {
260 if($_POST['update']!="now") {
261 $query = query("select * from `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
262 $result=mysql_query($query);
263 $num=mysql_num_rows($result);
264 $i=0;
265 $YourID=mysql_result($result,$i,"id");
266 $User1TimeZone=mysql_result($result,$i,"TimeZone"); 
267 $tsa_mem = explode(":",$User1TimeZone);
268 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
269 $User1DST=mysql_result($result,$i,"DST");
270 $settingsact = url_maker($exfile['profile'],$Settings['file_ext'],"act=settings",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
271 $profiletitle = " ".$ThemeSet['TitleDivider']." Board Settings"; ?>
272 <div class="Table1Border">
273 <table class="Table1" style="width: 100%;">
274 <tr class="TableRow1">
275 <td class="TableRow1"><span style="float: left;">
276 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $settingsact; ?>">Board Settings</a>
277 </span><span style="float: right;">&nbsp;</span></td>
278 </tr>
279 <tr id="ProfileTitle" class="TableRow2">
280 <th class="TableRow2">Board Settings</th>
281 </tr>
282 <tr class="TableRow3" id="BoardSettings">
283 <td class="TableRow3">
284 <form method="post" action="<?php echo $settingsact; ?>">
285 <table style="text-align: left;">
286 <tr style="text-align: left;">
287         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
288         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
289 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
290 <?php
291 $plusi = 1; $minusi = 12;
292 $plusnum = 13; $minusnum = 0;
293 while ($minusi > $minusnum) {
294 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
295 --$minusi; }
296 ?>
297 <option value="0">GMT +/- 0:00 hours</option>
298 <?php
299 while ($plusi < $plusnum) {
300 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
301 ++$plusi; }
302 ?></select></td>
303 </tr><tr style="text-align: left;">
304         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
305         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
306 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
307 <?php
308 $mini = 0; $minnum = 60;
309 while ($mini < $minnum) {
310 if(strlen($mini)==2) { $showmin = $mini; }
311 if(strlen($mini)==1) { $showmin = "0".$mini; }
312 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
313 ++$mini; }
314 ?></select></td>
315 </tr><tr style="text-align: left;">
316         <td style="width: 40%;"><label class="TextBoxLabel" for="skin">Pick a CSS Theme</label></td>
317         <td style="width: 60%;"><select id="skin" name="skin" class="TextBox">
318 <option selected="selected" value="<?php echo $_SESSION['Theme']; ?>">Old Value (<?php echo $_SESSION['Theme']; ?>)</option><?php
319 $skindir = dirname(realpath("settings.php"))."/".$SettDir['themes'];
320 if ($handle = opendir($skindir)) {
321    while (false !== ($file = readdir($handle))) {
322            if ($dirnum==null) { $dirnum = 0; }
323            if (file_exists($skindir.$file."/info.php")) {
324                    if ($file != "." && $file != "..") {
325            include($skindir.$file."/info.php");
326        $themelist[$dirnum] =  "<option value=\"".$file."\">".$ThemeInfo['ThemeName']."</option>";
327            ++$dirnum;
328    } } }
329    closedir($handle); asort($themelist);
330    $themenum=count($themelist); $themei=0; 
331    while ($themei < $themenum) {
332    echo $themelist[$themei]."\n";
333    ++$themei; }
334 } ?></select></td>
335 </tr><tr style="text-align: left;">
336         <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>
337         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
338 <?php if($User1DST=="off"||$User1DST!="on") { ?>
339 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
340 <?php } if($User1DST=="on") { ?>
341 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
342 <?php } echo "\n" ?></select></td>
343 </tr></table>
344 <table style="text-align: left;">
345 <tr style="text-align: left;">
346 <td style="width: 100%;">
347 <input type="hidden" name="act" value="settings" style="display: none;" />
348 <input type="hidden" name="update" value="now" style="display: none;" />
349 <input type="submit" class="Button" value="Save" />
350 <input class="Button" type="reset" />
351 </td></tr></table>
352 </form></td>
353 </tr>
354 <tr id="ProfileEnd" class="TableRow4">
355 <td class="TableRow4">&nbsp;</td>
356 </tr>
357 </table>
358 </div>
359 <?php @mysql_free_result($result); }
360 if($_POST['update']=="now") {
361 if($_POST['act']=="settings"&&
362         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
363         $NewDay=GMTimeStamp();
364         $NewIP=$_SERVER['REMOTE_ADDR'];
365         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
366         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
367         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
368         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
369         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
370         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
371         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
372         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
373         $_SESSION['UserDST'] = $_POST['DST'];
374         $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']));
375         mysql_query($querynewskin); } } }
376 if($_GET['act']=="profile") {
377 if($_POST['update']!="now") {
378 $query = query("select * from `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
379 $result=mysql_query($query);
380 $num=mysql_num_rows($result);
381 $i=0;
382 $YourID=mysql_result($result,$i,"id");
383 $User1Interests=mysql_result($result,$i,"Interests"); 
384 $User1Title=mysql_result($result,$i,"Title");
385 $User1Website=mysql_result($result,$i,"Website"); 
386 $User1Gender=mysql_result($result,$i,"Gender");
387 $User1TimeZone=mysql_result($result,$i,"TimeZone"); 
388 $tsa_mem = explode(":",$User1TimeZone);
389 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
390 $User1DST=mysql_result($result,$i,"DST");
391 $profileact = url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
392 $profiletitle = " ".$ThemeSet['TitleDivider']." Profile Editor";
393 ?>
394 <div class="Table1Border">
395 <table class="Table1" style="width: 100%;">
396 <tr class="TableRow1">
397 <td class="TableRow1"><span style="float: left;">
398 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
399 </span><span style="float: right;">&nbsp;</span></td>
400 </tr>
401 <tr id="ProfileTitle" class="TableRow2">
402 <th class="TableRow2">Profile Editor</th>
403 </tr>
404 <tr class="TableRow3" id="ProfileEditor">
405 <td class="TableRow3">
406 <form method="post" action="<?php echo $profileact; ?>">
407 <table style="text-align: left;">
408 <tr style="text-align: left;">
409         <td style="width: 40%;"><label class="TextBoxLabel" for="Interests">Your Interests</label></td>
410         <td style="width: 60%;"><input type="text" class="TextBox" name="Interests" id="Interests" value="<?php echo $User1Interests; ?>" /></td>
411 </tr><tr style="text-align: left;">
412         <td style="width: 40%;"><label class="TextBoxLabel" for="Title">Your Title</label></td>
413         <td style="width: 60%;"><input type="text" class="TextBox" name="Title" id="Title" value="<?php echo $User1Title; ?>" /></td>
414 </tr><tr style="text-align: left;">
415         <td style="width: 40%;"><label class="TextBoxLabel" for="Website">Your Website</label></td>
416         <td style="width: 60%;"><input type="text" class="TextBox" name="Website" id="Website" value="<?php echo $User1Website; ?>" /></td>
417 </tr><tr style="text-align: left;">
418         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
419         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
420 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
421 <?php
422 $plusi = 1; $minusi = 12;
423 $plusnum = 13; $minusnum = 0;
424 while ($minusi > $minusnum) {
425 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
426 --$minusi; }
427 ?>
428 <option value="0">GMT +/- 0:00 hours</option>
429 <?php
430 while ($plusi < $plusnum) {
431 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
432 ++$plusi; }
433 ?></select></td>
434 </tr><tr style="text-align: left;">
435         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
436         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
437 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
438 <?php
439 $mini = 0; $minnum = 60;
440 while ($mini < $minnum) {
441 if(strlen($mini)==2) { $showmin = $mini; }
442 if(strlen($mini)==1) { $showmin = "0".$mini; }
443 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
444 ++$mini; }
445 ?></select></td>
446 </tr><tr style="text-align: left;">
447         <td style="width: 40%;"><label class="TextBoxLabel" for="YourGender">Your Gender:</label></td>
448         <td style="width: 60%;"><select id="YourGender" name="YourGender" class="TextBox">
449 <option selected="selected" value="<?php echo $User1Gender; ?>">Old Value (<?php echo $User1Gender; ?>)</option>
450 <option value="Male">Male</option>
451 <option value="Female">Female</option>
452 <option value="Unknow">Unknow</option>
453 </select></td>
454 </tr><tr style="text-align: left;">
455         <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>
456         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
457 <?php if($User1DST=="off"||$User1DST!="on") { ?>
458 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
459 <?php } if($User1DST=="on") { ?>
460 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
461 <?php } echo "\n" ?></select></td>
462 </tr></table>
463 <table style="text-align: left;">
464 <tr style="text-align: left;">
465 <td style="width: 100%;">
466 <input type="hidden" name="act" value="profile" style="display: none;" />
467 <input type="hidden" name="update" value="now" style="display: none;" />
468 <input type="submit" class="Button" value="Save" />
469 <input class="Button" type="reset" />
470 </td></tr></table>
471 </form></td>
472 </tr>
473 <tr id="ProfileEnd" class="TableRow4">
474 <td class="TableRow4">&nbsp;</td>
475 </tr>
476 </table>
477 </div>
478 <?php @mysql_free_result($result); }
479 if($_POST['update']=="now") {
480 if($_POST['act']=="profile"&&
481         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
482         $_POST['Interests'] = htmlentities($_POST['Interests'], ENT_QUOTES);
483         $_POST['Interests'] = @remove_spaces($_POST['Interests']);
484         $_POST['Title'] = htmlentities($_POST['Title'], ENT_QUOTES);
485         $_POST['Title'] = @remove_spaces($_POST['Title']);
486         $_POST['Website'] = htmlentities($_POST['Website'], ENT_QUOTES);
487         $_POST['Website'] = @remove_spaces($_POST['Website']);
488         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
489         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
490         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
491         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
492         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
493         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
494         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
495         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
496         $_SESSION['UserDST'] = $_POST['DST'];
497         $NewDay=GMTimeStamp();
498         $NewIP=$_SERVER['REMOTE_ADDR'];
499         $querynewprofile = query("update `".$Settings['sqltable']."members` set `Interests`='%s',`Title`='%s',`Website`='%s',`TimeZone`='%s',`Gender`='%s',`DST`='%s',`LastActive`=%i,`IP`='%s' WHERE `id`=%i", array($_POST['Interests'],$_POST['Title'],$_POST['Website'],$_POST['YourOffSet'],$_POST['YourGender'],$_POST['DST'],$NewDay,$NewIP,$_SESSION['UserID']));
500         mysql_query($querynewprofile); } } }
501 if($_GET['act']=="userinfo") {
502 if($_POST['update']!="now") {
503 $query = query("select * from `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
504 $result=mysql_query($query);
505 $num=mysql_num_rows($result);
506 $i=0;
507 $YourID=mysql_result($result,$i,"id");
508 $User1Email=mysql_result($result,$i,"Email"); 
509 $userinfoact = url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
510 $profiletitle = " ".$ThemeSet['TitleDivider']." User Info Editer";
511 ?>
512 <div class="Table1Border">
513 <table class="Table1" style="width: 100%;">
514 <tr class="TableRow1">
515 <td class="TableRow1"><span style="float: left;">
516 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
517 </span><span style="float: right;">&nbsp;</span></td>
518 </tr>
519 <tr id="ProfileTitle" class="TableRow2">
520 <th class="TableRow2">User Info Editer</th>
521 </tr>
522 <tr class="TableRow3" id="UserInfoEditor">
523 <td class="TableRow3">
524 <form method="post" action="<?php echo $userinfoact; ?>">
525 <table style="text-align: left;">
526 <tr style="text-align: left;">
527         <td style="width: 40%;"><label class="TextBoxLabel" for="OldPass">Insert old Password:</label></td>
528         <td style="width: 60%;"><input type="password" class="TextBox" name="OldPass" size="20" id="OldPass" maxlength="30" /></td>
529 </tr><tr style="text-align: left;">
530         <td style="width: 40%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
531         <td style="width: 60%;"><input type="password" class="TextBox" name="Password" size="20" id="Password" maxlength="30" /></td>
532 </tr><tr style="text-align: left;">
533         <td style="width: 40%;"><label class="TextBoxLabel" for="RePassword">ReInsert a Password:</label></td>
534         <td style="width: 60%;"><input type="password" class="TextBox" name="RePassword" size="20" id="RePassword" maxlength="30" /></td>
535 </tr><tr style="text-align: left;">
536         <td style="width: 40%;"><label class="TextBoxLabel" for="Email">Insert Your Email:</label></td>
537         <td style="width: 60%;"><input type="text" class="TextBox" name="Email" size="20" id="Email" value="<?php echo $User1Email; ?>" /></td>
538 </tr></table>
539 <table style="text-align: left;">
540 <tr style="text-align: left;">
541 <td style="width: 100%;">
542 <input type="hidden" name="act" value="userinfo" style="display: none;" />
543 <input type="hidden" name="update" value="now" style="display: none;" />
544 <input type="submit" class="Button" value="Save" />
545 <input class="Button" type="reset" />
546 </td></tr></table>
547 </form></td>
548 </tr>
549 <tr id="ProfileEnd" class="TableRow4">
550 <td class="TableRow4">&nbsp;</td>
551 </tr>
552 </table>
553 </div>
554 <?php @mysql_free_result($result); }
555 if($_POST['update']=="now") {
556 if($_POST['act']=="userinfo"&&
557         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
558         $query = query("select * from `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
559         $result=mysql_query($query);
560         $num=mysql_num_rows($result);
561         $i=0;
562         $OldPassword=mysql_result($result,$i,"Password");
563         $OldHashType=mysql_result($result,$i,"HashType");
564         $OldJoined=mysql_result($result,$i,"Joined");
565         $OldSalt=mysql_result($result,$i,"Salt");
566         $UpdateHash = false; $NewSalt = salt_hmac(); 
567 if($OldHashType=="ODFH") { 
568         $YourPassword = sha1(md5($_POST['OldPass']));
569         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
570 if($OldHashType=="DF4H") { 
571         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
572         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
573 if($OldHashType=="iDBH"&&$UpdateHash!=true) { 
574         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
575         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
576 if($YourPassword!=$OldPassword) { $Error="Yes"; ?>
577 <div class="TableMessage" style="text-align: center;">Your old Password did not match.<br />&nbsp;</div>
578 <?php } if(strlen($_POST['Password'])=="30") { $Error="Yes"; ?>
579 <div class="TableMessage" style="text-align: center;">Your password is too big.<br />&nbsp;</div>
580 <?php } if(strlen($_POST['OldPass'])=="30") { $Error="Yes"; ?>
581 <div class="TableMessage" style="text-align: center;">Your old password is too big.<br />&nbsp;</div>
582 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
583 <div class="TableMessage" style="text-align: center;">Your passwords did not match.<br />&nbsp;</div>
584 <?php }
585         $NewDay=GMTimeStamp();
586         $NewIP=$_SERVER['REMOTE_ADDR'];
587         if ($Error!="Yes") {
588         setcookie("SessPass", $NewPassword, time() + (7 * 86400), $basedir);
589         $_POST['Email'] = @remove_spaces($_POST['Email']);
590         $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']));
591         mysql_query($querynewuserinfo); } } } }
592 ?>
593 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
594         $profiletitle = " - Updating Settings"; ?>
595 </td></tr>
596 <tr id="ProfileTitleEnd" class="TableRow4">
597 <td class="TableRow4">&nbsp;</td>
598 </tr></table></div><?php } ?>
599 </td></tr>
600 </table>