OSDN Git Service

Fixed some bugs and also started work on admin cp. :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: 08/31/2007 SVN 93 - 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 $BirthDay=mysql_result($result,$i,"BirthDay");
389 $BirthMonth=mysql_result($result,$i,"BirthMonth");
390 $BirthYear=mysql_result($result,$i,"BirthYear");
391 $User1Birthday = "MM/DD/YYYY";
392 if($BirthMonth!=null&&$BirthDay!=null&&$BirthYear!=null) { 
393         if($BirthYear=="0") { $BirthYear = "YYYY"; }
394         if($BirthDay=="0") { $BirthDay = "DD"; }
395         if($BirthMonth=="0") { $BirthMonth = "MM"; }
396         if(strlen($BirthMonth)=="1") { $BirthMonth = "0".$BirthMonth; }
397         if(strlen($BirthDay)=="1") { $BirthDay = "0".$BirthDay; }
398         $User1Birthday = $BirthMonth."/".$BirthDay."/".$BirthYear; }
399 $tsa_mem = explode(":",$User1TimeZone);
400 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
401 $User1DST=mysql_result($result,$i,"DST");
402 $profileact = url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
403 $profiletitle = " ".$ThemeSet['TitleDivider']." Profile Editor";
404 ?>
405 <div class="Table1Border">
406 <table class="Table1" style="width: 100%;">
407 <tr class="TableRow1">
408 <td class="TableRow1"><span style="float: left;">
409 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
410 </span><span style="float: right;">&nbsp;</span></td>
411 </tr>
412 <tr id="ProfileTitle" class="TableRow2">
413 <th class="TableRow2">Profile Editor</th>
414 </tr>
415 <tr class="TableRow3" id="ProfileEditor">
416 <td class="TableRow3">
417 <form method="post" action="<?php echo $profileact; ?>">
418 <table style="text-align: left;">
419 <tr style="text-align: left;">
420         <td style="width: 40%;"><label class="TextBoxLabel" for="Interests">Your Interests</label></td>
421         <td style="width: 60%;"><input type="text" class="TextBox" name="Interests" id="Interests" value="<?php echo $User1Interests; ?>" /></td>
422 </tr><tr style="text-align: left;">
423         <td style="width: 40%;"><label class="TextBoxLabel" for="Title">Your Title</label></td>
424         <td style="width: 60%;"><input type="text" class="TextBox" name="Title" id="Title" value="<?php echo $User1Title; ?>" /></td>
425 </tr><tr style="text-align: left;">
426         <td style="width: 40%;"><label class="TextBoxLabel" for="Website">Your Website</label></td>
427         <td style="width: 60%;"><input type="text" class="TextBox" name="Website" id="Website" value="<?php echo $User1Website; ?>" /></td>
428 </tr><tr style="text-align: left;">
429         <td style="width: 40%;"><label class="TextBoxLabel" for="EventDay">Your Birthday</label></td>
430         <td style="width: 60%;"><input type="text" class="TextBox" name="EventDay" id="EventDay" value="<?php echo $User1Birthday; ?>" /></td>
431 </tr><tr style="text-align: left;">
432         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
433         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
434 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
435 <?php
436 $plusi = 1; $minusi = 12;
437 $plusnum = 13; $minusnum = 0;
438 while ($minusi > $minusnum) {
439 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
440 --$minusi; }
441 ?>
442 <option value="0">GMT +/- 0:00 hours</option>
443 <?php
444 while ($plusi < $plusnum) {
445 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
446 ++$plusi; }
447 ?></select></td>
448 </tr><tr style="text-align: left;">
449         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
450         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
451 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
452 <?php
453 $mini = 0; $minnum = 60;
454 while ($mini < $minnum) {
455 if(strlen($mini)==2) { $showmin = $mini; }
456 if(strlen($mini)==1) { $showmin = "0".$mini; }
457 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
458 ++$mini; }
459 ?></select></td>
460 </tr><tr style="text-align: left;">
461         <td style="width: 40%;"><label class="TextBoxLabel" for="YourGender">Your Gender:</label></td>
462         <td style="width: 60%;"><select id="YourGender" name="YourGender" class="TextBox">
463 <option selected="selected" value="<?php echo $User1Gender; ?>">Old Value (<?php echo $User1Gender; ?>)</option>
464 <option value="Male">Male</option>
465 <option value="Female">Female</option>
466 <option value="Unknow">Unknow</option>
467 </select></td>
468 </tr><tr style="text-align: left;">
469         <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>
470         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
471 <?php if($User1DST=="off"||$User1DST!="on") { ?>
472 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
473 <?php } if($User1DST=="on") { ?>
474 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
475 <?php } echo "\n" ?></select></td>
476 </tr></table>
477 <table style="text-align: left;">
478 <tr style="text-align: left;">
479 <td style="width: 100%;">
480 <input type="hidden" name="act" value="profile" style="display: none;" />
481 <input type="hidden" name="update" value="now" style="display: none;" />
482 <input type="submit" class="Button" value="Save" />
483 <input class="Button" type="reset" />
484 </td></tr></table>
485 </form></td>
486 </tr>
487 <tr id="ProfileEnd" class="TableRow4">
488 <td class="TableRow4">&nbsp;</td>
489 </tr>
490 </table>
491 </div>
492 <?php @mysql_free_result($result); }
493 if($_POST['update']=="now") {
494 if($_POST['act']=="profile"&&
495         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
496         $_POST['Interests'] = htmlentities($_POST['Interests'], ENT_QUOTES);
497         $_POST['Interests'] = @remove_spaces($_POST['Interests']);
498         $_POST['Title'] = htmlentities($_POST['Title'], ENT_QUOTES);
499         $_POST['Title'] = @remove_spaces($_POST['Title']);
500         $_POST['Website'] = htmlentities($_POST['Website'], ENT_QUOTES);
501         $_POST['Website'] = @remove_spaces($_POST['Website']);
502         if(!isset($_POST['EventDay'])) { $_POST['EventDay'] = null; }
503         if($_POST['EventDay']!=null) {
504         $BirthExpl = explode("/",$_POST['EventDay']);
505         if(count($BirthExpl)=="3") {
506         if(is_numeric($BirthExpl[0])&&is_numeric($BirthExpl[1])&&is_numeric($BirthExpl[2])) {
507         if(strlen($BirthExpl[0])=="1") { $BirthExpl[0] = "0".$BirthExpl[0]; }
508         if(strlen($BirthExpl[1])=="1") { $BirthExpl[1] = "0".$BirthExpl[1]; }
509         if(strlen($BirthExpl[0])=="2"&&strlen($BirthExpl[1])=="2"&&strlen($BirthExpl[2])=="4") {
510         $BirthIn = mktime(12,12,12,$BirthExpl[0],$BirthExpl[1],$BirthExpl[2]);
511         $BirthMonth=GMTimeChange("m",$BirthIn,0,0,"off");
512         $BirthDay=GMTimeChange("d",$BirthIn,0,0,"off");
513         $BirthYear=GMTimeChange("Y",$BirthIn,0,0,"off"); }
514         if(strlen($BirthExpl[0])!="2"||strlen($BirthExpl[1])!="2"||strlen($BirthExpl[2])!="4") { 
515                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
516         if (!is_numeric($BirthExpl[0])||!is_numeric($BirthExpl[1])||!is_numeric($BirthExpl[2])) { 
517                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
518         if(count($BirthExpl)!="3") { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
519         if($_POST['EventDay']==null) { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
520         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
521         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
522         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
523         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
524         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
525         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
526         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
527         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
528         $_SESSION['UserDST'] = $_POST['DST'];
529         $NewDay=GMTimeStamp();
530         $NewIP=$_SERVER['REMOTE_ADDR'];
531         $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']));
532         mysql_query($querynewprofile); } } }
533 if($_GET['act']=="userinfo") {
534 if($_POST['update']!="now") {
535 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
536 $result=mysql_query($query);
537 $num=mysql_num_rows($result);
538 $i=0;
539 $YourID=mysql_result($result,$i,"id");
540 $User1Email=mysql_result($result,$i,"Email"); 
541 $userinfoact = url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
542 $profiletitle = " ".$ThemeSet['TitleDivider']." User Info Editer";
543 ?>
544 <div class="Table1Border">
545 <table class="Table1" style="width: 100%;">
546 <tr class="TableRow1">
547 <td class="TableRow1"><span style="float: left;">
548 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
549 </span><span style="float: right;">&nbsp;</span></td>
550 </tr>
551 <tr id="ProfileTitle" class="TableRow2">
552 <th class="TableRow2">User Info Editer</th>
553 </tr>
554 <tr class="TableRow3" id="UserInfoEditor">
555 <td class="TableRow3">
556 <form method="post" action="<?php echo $userinfoact; ?>">
557 <table style="text-align: left;">
558 <tr style="text-align: left;">
559         <td style="width: 40%;"><label class="TextBoxLabel" for="OldPass">Insert old Password:</label></td>
560         <td style="width: 60%;"><input type="password" class="TextBox" name="OldPass" size="20" id="OldPass" maxlength="30" /></td>
561 </tr><tr style="text-align: left;">
562         <td style="width: 40%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
563         <td style="width: 60%;"><input type="password" class="TextBox" name="Password" size="20" id="Password" maxlength="30" /></td>
564 </tr><tr style="text-align: left;">
565         <td style="width: 40%;"><label class="TextBoxLabel" for="RePassword">ReInsert a Password:</label></td>
566         <td style="width: 60%;"><input type="password" class="TextBox" name="RePassword" size="20" id="RePassword" maxlength="30" /></td>
567 </tr><tr style="text-align: left;">
568         <td style="width: 40%;"><label class="TextBoxLabel" for="Email">Insert Your Email:</label></td>
569         <td style="width: 60%;"><input type="text" class="TextBox" name="Email" size="20" id="Email" value="<?php echo $User1Email; ?>" /></td>
570 </tr></table>
571 <table style="text-align: left;">
572 <tr style="text-align: left;">
573 <td style="width: 100%;">
574 <input type="hidden" name="act" value="userinfo" style="display: none;" />
575 <input type="hidden" name="update" value="now" style="display: none;" />
576 <input type="submit" class="Button" value="Save" />
577 <input class="Button" type="reset" />
578 </td></tr></table>
579 </form></td>
580 </tr>
581 <tr id="ProfileEnd" class="TableRow4">
582 <td class="TableRow4">&nbsp;</td>
583 </tr>
584 </table>
585 </div>
586 <?php @mysql_free_result($result); }
587 if($_POST['update']=="now") {
588 if($_POST['act']=="userinfo"&&
589         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
590         $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
591         $result=mysql_query($query);
592         $num=mysql_num_rows($result);
593         $i=0;
594         $OldPassword=mysql_result($result,$i,"Password");
595         $OldHashType=mysql_result($result,$i,"HashType");
596         $OldJoined=mysql_result($result,$i,"Joined");
597         $OldSalt=mysql_result($result,$i,"Salt");
598         $UpdateHash = false; $NewSalt = salt_hmac(); 
599 if($OldHashType=="ODFH") { 
600         $YourPassword = sha1(md5($_POST['OldPass']));
601         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
602 if($OldHashType=="DF4H") { 
603         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
604         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
605 if($OldHashType=="iDBH"&&$UpdateHash!=true) { 
606         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
607         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
608 if($YourPassword!=$OldPassword) { $Error="Yes"; ?>
609 <div class="TableMessage" style="text-align: center;">Your old Password did not match.<br />&nbsp;</div>
610 <?php } if(strlen($_POST['Password'])=="30") { $Error="Yes"; ?>
611 <div class="TableMessage" style="text-align: center;">Your password is too big.<br />&nbsp;</div>
612 <?php } if(strlen($_POST['OldPass'])=="30") { $Error="Yes"; ?>
613 <div class="TableMessage" style="text-align: center;">Your old password is too big.<br />&nbsp;</div>
614 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
615 <div class="TableMessage" style="text-align: center;">Your passwords did not match.<br />&nbsp;</div>
616 <?php }
617         $NewDay=GMTimeStamp();
618         $NewIP=$_SERVER['REMOTE_ADDR'];
619         if ($Error!="Yes") { $_SESSION['UserPass']=$NewPassword;
620         setcookie("SessPass", $NewPassword, time() + (7 * 86400), $basedir);
621         $_POST['Email'] = @remove_spaces($_POST['Email']);
622         $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']));
623         mysql_query($querynewuserinfo); } } } }
624 ?>
625 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
626         $profiletitle = " - Updating Settings"; ?>
627 </td></tr>
628 <tr id="ProfileTitleEnd" class="TableRow4">
629 <td class="TableRow4">&nbsp;</td>
630 </tr></table></div><?php } ?>
631 </td></tr>
632 </table>
633 <div>&nbsp;</div>