OSDN Git Service

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