OSDN Git Service

Fixed some mysql queries. ^_^
[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: 06/18/2007 SVN 26 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="profilemain.php"||$File3Name=="/profilemain.php") {
18         require('index.php');
19         exit(); }
20 if(!isset($_POST['update'])) { $_POST['update'] = null; }
21 ?>
22 <table class="Table3">
23 <tr style="width: 100%; vertical-align: top;">
24         <td style="width: 15%; vertical-align: top;">
25         <table id="ProfileLinks" class="Table1" style="width: 100%; float: left; vertical-align: top;">
26 <tr class="TableRow1">
27 <td class="TableRow1"><?php echo $ThemeSet['TitleIcon'] ?>Profile Settings</td>
28 </tr><tr class="TableRow2">
29 <td class="TableRow2">&nbsp;</td>
30 </tr><tr class="TableRow3">
31 <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>
32 </tr><tr class="TableRow3">
33 <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>
34 </tr><tr class="TableRow3">
35 <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>
36 </tr><tr class="TableRow3">
37 <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>
38 </tr><tr class="TableRow4">
39 <td class="TableRow4">&nbsp;</td>
40 </tr></table><div>&nbsp;</div>
41 <table class="Table1" style="width: 100%; float: left; vertical-align: top;">
42 <tr class="TableRow1">
43 <td class="TableRow1"><?php echo $ThemeSet['TitleIcon'] ?>Board Settings</td>
44 </tr><tr class="TableRow2">
45 <td class="TableRow2">&nbsp;</td>
46 </tr><tr class="TableRow3">
47 <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>
48 </tr><tr class="TableRow3">
49 <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>
50 </tr><tr class="TableRow4">
51 <td class="TableRow4">&nbsp;</td>
52 </tr></table>
53 </td>
54         <td style="width: 85%; vertical-align: top;">
55 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
56 $updateact = url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
57 $profiletitle = " - Updating Settings";
58 @redirect("refresh",$basedir.url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile'],FALSE),"3");
59 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
60 $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
61 ?>
62 <div class="Table1Border">
63 <table class="Table1" style="width: 100%;">
64 <tr class="TableRow1">
65 <td class="TableRow1"><span style="float: left;">
66 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $updateact; ?>">Updating Settings</a>
67 </span><span style="float: right;">&nbsp;</span></td>
68 </tr>
69 <tr id="ProfileTitle" class="TableRow2">
70 <th class="TableRow2">Updating Settings</th>
71 </tr>
72 <tr class="TableRow3" id="ProfileUpdate">
73 <td class="TableRow3">
74 <div style="text-align: center;">
75 <br />Profile updated <a href="<?php echo $updateact; ?>">click here</a> to go back. ^_^<br />&nbsp;</div>
76 <?php } if($_GET['act']=="view") {
77 if($_POST['update']!="now") {
78 $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
79 $result=mysql_query($query);
80 $num=mysql_num_rows($result);
81 $i=0;
82 $YourID=mysql_result($result,$i,"id");
83 $Notes=mysql_result($result,$i,"Notes");
84 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
85 $notepadact = $noteact; $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
86 ?>
87 <div class="Table1Border">
88 <table class="Table1" style="width: 100%;">
89 <tr class="TableRow1">
90 <td class="TableRow1"><span style="float: left;">
91 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $noteact; ?>">NotePad</a>
92 </span><span style="float: right;">&nbsp;</span></td>
93 </tr>
94 <tr id="ProfileTitle" class="TableRow2">
95 <th class="TableRow2">NotePad</th>
96 </tr>
97 <tr class="TableRow3" id="NotePadRow">
98 <td class="TableRow3">
99 <form method="post" action="<?php echo $notepadact; ?>"><div style="text-align: center;">
100 <label class="TextBoxLabel" for="NotePad">Your NotePad</label><br />
101 <textarea class="TextBox" name="NotePad" id="NotePad" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Notes; ?></textarea>
102 <input type="hidden" name="act" value="view" style="display: none;" />
103 <input type="hidden" name="update" value="now" style="display: none;" />
104 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
105 </div></form></td>
106 </tr>
107 <tr id="ProfileEnd" class="TableRow4">
108 <td class="TableRow4">&nbsp;</td>
109 </tr>
110 </table>
111 </div>
112 <?php @mysql_free_result($result); }
113 if($_POST['update']=="now") {
114 if($_POST['act']=="view"&&
115         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
116         $_POST['NotePad'] = htmlentities($_POST['NotePad'], ENT_QUOTES);
117         $NewDay=GMTimeStamp();
118         $NewIP=$_SERVER['REMOTE_ADDR'];
119         $querynewskin = query("update ".$Settings['sqltable']."members set `Notes`='%s',`LastActive`='%s',`IP`='%s' WHERE `id`=%i", array($_POST['NotePad'],$NewDay,$NewIP,$_SESSION['UserID']));
120                 mysql_query($querynewskin); } } }
121 if($_GET['act']=="signature") {
122 if($_POST['update']!="now") {
123 $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
124 $result=mysql_query($query);
125 $num=mysql_num_rows($result);
126 $i=0;
127 $YourID=mysql_result($result,$i,"id");
128 $Signature=mysql_result($result,$i,"Signature"); 
129 $signatureact = url_maker($exfile['profile'],$Settings['file_ext'],"act=signature",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
130 $profiletitle = " ".$ThemeSet['TitleDivider']." Signature Editor";
131 ?>
132 <div class="Table1Border">
133 <table class="Table1" style="width: 100%;">
134 <tr class="TableRow1">
135 <td class="TableRow1"><span style="float: left;">
136 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $signatureact; ?>">Signature Editer</a>
137 </span><span style="float: right;">&nbsp;</span></td>
138 </tr>
139 <tr id="ProfileTitle" class="TableRow2">
140 <th class="TableRow2">Signature Editor</th>
141 </tr>
142 <tr class="TableRow3" id="SignatureRow">
143 <td class="TableRow3">
144 <form method="post" action="<?php echo $signatureact; ?>"><div style="text-align: center;">
145 <label class="TextBoxLabel" for="Signature">Your Signature</label><br />
146 <textarea class="TextBox" name="Signature" id="Signature" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Signature; ?></textarea>
147 <input type="hidden" name="act" value="signature" style="display: none;" />
148 <input type="hidden" name="update" value="now" style="display: none;" />
149 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
150 </div></form></td>
151 </tr>
152 <tr id="ProfileEnd" class="TableRow4">
153 <td class="TableRow4">&nbsp;</td>
154 </tr>
155 </table>
156 </div>
157 <?php @mysql_free_result($result); }
158 if($_POST['update']=="now") {
159 if($_POST['act']=="signature"&&
160         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
161         $_POST['Signature'] = htmlentities($_POST['Signature'], ENT_QUOTES);
162         $_POST['Signature'] = preg_replace("/\t+/"," ",$_POST['Signature']);
163         $_POST['Signature'] = preg_replace("/\s\s+/"," ",$_POST['Signature']);
164         $NewDay=GMTimeStamp();
165         $NewIP=$_SERVER['REMOTE_ADDR'];
166         $querynewskin = query("update ".$Settings['sqltable']."members set `Signature`='%s',`LastActive`='%s',`IP`='%s' WHERE `id`=%i", array($_POST['Signature'],$NewDay,$NewIP,$_SESSION['UserID']));
167         mysql_query($querynewskin); } } }
168 if($_GET['act']=="avatar") {
169 if($_POST['update']!="now") {
170 $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
171 $result=mysql_query($query);
172 $num=mysql_num_rows($result);
173 $i=0;
174 $YourID=mysql_result($result,$i,"id");
175 $User1Avatar=mysql_result($result,$i,"Avatar"); 
176 $User1AvatarSize=mysql_result($result,$i,"AvatarSize");
177 $avataract = url_maker($exfile['profile'],$Settings['file_ext'],"act=avatar",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
178 $profiletitle = " ".$ThemeSet['TitleDivider']." Avatar Editor";
179 $Pre1Avatar = $User1Avatar;
180 if ($User1Avatar==null) { $User1Avatar="http://"; }
181 if ($Pre1Avatar=="http://"||$Pre1Avatar==null) {
182 $Pre1Avatar=$ThemeSet['NoAvatar'];
183 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
184 $AvatarSize1=explode("x", $User1AvatarSize);
185 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
186 ?>
187 <div class="Table1Border">
188 <table class="Table1" style="width: 100%;">
189 <tr class="TableRow1">
190 <td class="TableRow1"><span style="float: left;">
191 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $avataract; ?>">Avatar Editer</a>
192 </span><span style="float: right;">&nbsp;</span></td>
193 </tr>
194 <tr id="ProfileTitle" class="TableRow2">
195 <th class="TableRow2">Avatar Editor</th>
196 </tr>
197 <tr class="TableRow3" id="AvatarEditor">
198 <td class="TableRow3">
199 <form method="post" action="<?php echo $avataract; ?>">
200  <?php  /* Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/ */  ?>
201  <table class="AvatarTable" style="width: 100px; height: 100px; text-align: center;">
202         <tr class="AvatarRow" style="width: 100%; height: 100%;">
203                 <td class="AvatarRow" style="width: 100%; height: 100%; text-align: center; vertical-align: middle;">
204                 <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;" />
205                 </td>
206         </tr>
207  </table>
208 <table style="text-align: left;">
209 <tr style="text-align: left;">
210         <td style="width: 40%;"><label class="TextBoxLabel" for="Avatar">Your Avatar</label></td>
211         <td style="width: 60%;"><input type="text" class="TextBox" name="Avatar" id="Avatar" value="<?php echo $User1Avatar; ?>" size="20" /></td>
212         </tr><tr style="text-align: left;">
213         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeW">Avatar Width</label></td>
214         <td style="width: 60%;"><select size="1" name="AvatarSizeW" id="AvatarSizeW" class="TextBox">
215         <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; } ?>
216 </select></td>
217 </tr><tr style="text-align: left;">
218         <td style="width: 40%;"><label class="TextBoxLabel" for="AvatarSizeH">Avatar Height</label></td>
219         <td style="width: 60%;"><select size="1" name="AvatarSizeH" id="AvatarSizeH" class="TextBox">
220 <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; } ?>
221 </select></td>
222 </tr></table>
223 <table style="text-align: left;">
224 <tr style="text-align: left;">
225 <td style="width: 100%;">
226 <input type="hidden" name="act" value="avatar" style="display: none;" />
227 <input type="hidden" name="update" value="now" style="display: none;" />
228 <input type="submit" class="Button" value="Save" />
229 <input class="Button" type="reset" />
230 </td></tr></table>
231 </form></td>
232 </tr>
233 <tr id="ProfileEnd" class="TableRow4">
234 <td class="TableRow4">&nbsp;</td>
235 </tr>
236 </table>
237 </div>
238 <?php @mysql_free_result($result); }
239 if($_POST['update']=="now") {
240 if($_POST['Avatar']!=null&&$_POST['AvatarSizeW']!=null&&$_POST['AvatarSizeH']!=null&&
241         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
242         if($_POST['AvatarSizeW']>=100) { $_POST['AvatarSizeW']=100; }
243         if($_POST['AvatarSizeH']>=100) { $_POST['AvatarSizeH']=100; }
244         $fullavatarsize = $_POST['AvatarSizeW']."x".$_POST['AvatarSizeH'];
245         $_POST['Avatar'] = htmlentities($_POST['Avatar'], ENT_QUOTES);
246         $NewDay=GMTimeStamp();
247         $NewIP=$_SERVER['REMOTE_ADDR'];
248         $_POST['Avatar'] = @remove_spaces($_POST['Avatar']);
249         $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']));
250         mysql_query($querynewskin); } } }
251 if($_GET['act']=="settings") {
252 if($_POST['update']!="now") {
253 $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
254 $result=mysql_query($query);
255 $num=mysql_num_rows($result);
256 $i=0;
257 $YourID=mysql_result($result,$i,"id");
258 $User1TimeZone=mysql_result($result,$i,"TimeZone"); 
259 $User1DST=mysql_result($result,$i,"DST");
260 $settingsact = url_maker($exfile['profile'],$Settings['file_ext'],"act=settings",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
261 $profiletitle = " ".$ThemeSet['TitleDivider']." Board Settings"; ?>
262 <div class="Table1Border">
263 <table class="Table1" style="width: 100%;">
264 <tr class="TableRow1">
265 <td class="TableRow1"><span style="float: left;">
266 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $settingsact; ?>">Board Settings</a>
267 </span><span style="float: right;">&nbsp;</span></td>
268 </tr>
269 <tr id="ProfileTitle" class="TableRow2">
270 <th class="TableRow2">Board Settings</th>
271 </tr>
272 <tr class="TableRow3" id="BoardSettings">
273 <td class="TableRow3">
274 <form method="post" action="<?php echo $settingsact; ?>">
275 <table style="text-align: left;">
276 <tr style="text-align: left;">
277         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
278         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
279 <option selected="selected" value="<?php echo $User1TimeZone; ?>">Old Value (<?php echo $User1TimeZone.":00 hours"; ?>)</option>
280 <?php
281 $plusi = 1; $minusi = 12;
282 $plusnum = 13; $minusnum = 0;
283 while ($minusi > $minusnum) {
284 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
285 --$minusi; }
286 ?>
287 <option value="0">GMT +/- 0:00 hours</option>
288 <?php
289 while ($plusi < $plusnum) {
290 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
291 ++$plusi; }
292 ?></select></td>
293 </tr><tr style="text-align: left;">
294         <td style="width: 40%;"><label class="TextBoxLabel" for="skin">Pick a CSS Theme</label></td>
295         <td style="width: 60%;"><select id="skin" name="skin" class="TextBox">
296 <option selected="selected" value="<?php echo $_SESSION['Theme']; ?>">Old Value (<?php echo $_SESSION['Theme']; ?>)</option><?php
297 $skindir = dirname(realpath("settings.php"))."/".$SettDir['themes'];
298 if ($handle = opendir($skindir)) {
299    while (false !== ($file = readdir($handle))) {
300            if ($dirnum==null) { $dirnum = 0; }
301            if (file_exists($skindir.$file."/info.php")) {
302                    if ($file != "." && $file != "..") {
303            include($skindir.$file."/info.php");
304        $themelist[$dirnum] =  "<option value=\"".$file."\">".$ThemeInfo['ThemeName']."</option>";
305            ++$dirnum;
306    } } }
307    closedir($handle); asort($themelist);
308    $themenum=count($themelist); $themei=0; 
309    while ($themei < $themenum) {
310    echo $themelist[$themei]."\n";
311    ++$themei; }
312 } ?></select></td>
313 </tr><tr style="text-align: left;">
314         <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>
315         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
316 <?php if($User1DST=="off"||$User1DST!="on") { ?>
317 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
318 <?php } if($User1DST=="on") { ?>
319 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
320 <?php } echo "\n" ?></select></td>
321 </tr></table>
322 <table style="text-align: left;">
323 <tr style="text-align: left;">
324 <td style="width: 100%;">
325 <input type="hidden" name="act" value="settings" style="display: none;" />
326 <input type="hidden" name="update" value="now" style="display: none;" />
327 <input type="submit" class="Button" value="Save" />
328 <input class="Button" type="reset" />
329 </td></tr></table>
330 </form></td>
331 </tr>
332 <tr id="ProfileEnd" class="TableRow4">
333 <td class="TableRow4">&nbsp;</td>
334 </tr>
335 </table>
336 </div>
337 <?php @mysql_free_result($result); }
338 if($_POST['update']=="now") {
339 if($_POST['act']=="settings"&&
340         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
341         $NewDay=GMTimeStamp();
342         $NewIP=$_SERVER['REMOTE_ADDR'];
343         $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']));
344         mysql_query($querynewskin); } } }
345 if($_GET['act']=="profile") {
346 if($_POST['update']!="now") {
347 $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
348 $result=mysql_query($query);
349 $num=mysql_num_rows($result);
350 $i=0;
351 $YourID=mysql_result($result,$i,"id");
352 $User1Interests=mysql_result($result,$i,"Interests"); 
353 $User1Title=mysql_result($result,$i,"Title");
354 $User1Website=mysql_result($result,$i,"Website"); 
355 $User1Gender=mysql_result($result,$i,"Gender");
356 $User1TimeZone=mysql_result($result,$i,"TimeZone"); 
357 $User1DST=mysql_result($result,$i,"DST");
358 $profileact = url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
359 $profiletitle = " ".$ThemeSet['TitleDivider']." Profile Editor";
360 ?>
361 <div class="Table1Border">
362 <table class="Table1" style="width: 100%;">
363 <tr class="TableRow1">
364 <td class="TableRow1"><span style="float: left;">
365 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
366 </span><span style="float: right;">&nbsp;</span></td>
367 </tr>
368 <tr id="ProfileTitle" class="TableRow2">
369 <th class="TableRow2">Profile Editor</th>
370 </tr>
371 <tr class="TableRow3" id="ProfileEditor">
372 <td class="TableRow3">
373 <form method="post" action="<?php echo $profileact; ?>">
374 <table style="text-align: left;">
375 <tr style="text-align: left;">
376         <td style="width: 40%;"><label class="TextBoxLabel" for="Interests">Your Interests</label></td>
377         <td style="width: 60%;"><input type="text" class="TextBox" name="Interests" id="Interests" value="<?php echo $User1Interests; ?>" /></td>
378 </tr><tr style="text-align: left;">
379         <td style="width: 40%;"><label class="TextBoxLabel" for="Title">Your Title</label></td>
380         <td style="width: 60%;"><input type="text" class="TextBox" name="Title" id="Title" value="<?php echo $User1Title; ?>" /></td>
381 </tr><tr style="text-align: left;">
382         <td style="width: 40%;"><label class="TextBoxLabel" for="Website">Your Website</label></td>
383         <td style="width: 60%;"><input type="text" class="TextBox" name="Website" id="Website" value="<?php echo $User1Website; ?>" /></td>
384 </tr><tr style="text-align: left;">
385         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
386         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
387 <option selected="selected" value="<?php echo $User1TimeZone; ?>">Old Value (<?php echo $User1TimeZone.":00 hours"; ?>)</option>
388 <?php
389 $plusi = 1; $minusi = 12;
390 $plusnum = 13; $minusnum = 0;
391 while ($minusi > $minusnum) {
392 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
393 --$minusi; }
394 ?>
395 <option value="0">GMT +/- 0:00 hours</option>
396 <?php
397 while ($plusi < $plusnum) {
398 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
399 ++$plusi; }
400 ?></select></td>
401 </tr><tr style="text-align: left;">
402         <td style="width: 40%;"><label class="TextBoxLabel" for="YourGender">Your Gender:</label></td>
403         <td style="width: 60%;"><select id="YourGender" name="YourGender" class="TextBox">
404 <option selected="selected" value="<?php echo $User1Gender; ?>">Old Value (<?php echo $User1Gender; ?>)</option>
405 <option value="Male">Male</option>
406 <option value="Female">Female</option>
407 <option value="Unknow">Unknow</option>
408 </select></td>
409 </tr><tr style="text-align: left;">
410         <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>
411         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
412 <?php if($User1DST=="off"||$User1DST!="on") { ?>
413 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
414 <?php } if($User1DST=="on") { ?>
415 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
416 <?php } echo "\n" ?></select></td>
417 </tr></table>
418 <table style="text-align: left;">
419 <tr style="text-align: left;">
420 <td style="width: 100%;">
421 <input type="hidden" name="act" value="profile" style="display: none;" />
422 <input type="hidden" name="update" value="now" style="display: none;" />
423 <input type="submit" class="Button" value="Save" />
424 <input class="Button" type="reset" />
425 </td></tr></table>
426 </form></td>
427 </tr>
428 <tr id="ProfileEnd" class="TableRow4">
429 <td class="TableRow4">&nbsp;</td>
430 </tr>
431 </table>
432 </div>
433 <?php @mysql_free_result($result); }
434 if($_POST['update']=="now") {
435 if($_POST['act']=="profile"&&
436         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
437         $_POST['Interests'] = htmlentities($_POST['Interests'], ENT_QUOTES);
438         $_POST['Interests'] = @remove_spaces($_POST['Interests']);
439         $_POST['Title'] = htmlentities($_POST['Title'], ENT_QUOTES);
440         $_POST['Title'] = @remove_spaces($_POST['Title']);
441         $_POST['Website'] = htmlentities($_POST['Website'], ENT_QUOTES);
442         $_POST['Website'] = @remove_spaces($_POST['Website']);
443         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
444         $_SESSION['UserDST'] = $_POST['DST'];
445         $NewDay=GMTimeStamp();
446         $NewIP=$_SERVER['REMOTE_ADDR'];
447         $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']));
448         mysql_query($querynewprofile); } } }
449 if($_GET['act']=="userinfo") {
450 if($_POST['update']!="now") {
451 $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
452 $result=mysql_query($query);
453 $num=mysql_num_rows($result);
454 $i=0;
455 $YourID=mysql_result($result,$i,"id");
456 $User1Email=mysql_result($result,$i,"Email"); 
457 $userinfoact = url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
458 $profiletitle = " ".$ThemeSet['TitleDivider']." User Info Editer";
459 ?>
460 <div class="Table1Border">
461 <table class="Table1" style="width: 100%;">
462 <tr class="TableRow1">
463 <td class="TableRow1"><span style="float: left;">
464 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
465 </span><span style="float: right;">&nbsp;</span></td>
466 </tr>
467 <tr id="ProfileTitle" class="TableRow2">
468 <th class="TableRow2">User Info Editer</th>
469 </tr>
470 <tr class="TableRow3" id="UserInfoEditor">
471 <td class="TableRow3">
472 <form method="post" action="<?php echo $userinfoact; ?>">
473 <table style="text-align: left;">
474 <tr style="text-align: left;">
475         <td style="width: 40%;"><label class="TextBoxLabel" for="OldPass">Insert old Password:</label></td>
476         <td style="width: 60%;"><input type="password" class="TextBox" name="OldPass" size="20" id="OldPass" maxlength="30" /></td>
477 </tr><tr style="text-align: left;">
478         <td style="width: 40%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
479         <td style="width: 60%;"><input type="password" class="TextBox" name="Password" size="20" id="Password" maxlength="30" /></td>
480 </tr><tr style="text-align: left;">
481         <td style="width: 40%;"><label class="TextBoxLabel" for="RePassword">ReInsert a Password:</label></td>
482         <td style="width: 60%;"><input type="password" class="TextBox" name="RePassword" size="20" id="RePassword" maxlength="30" /></td>
483 </tr><tr style="text-align: left;">
484         <td style="width: 40%;"><label class="TextBoxLabel" for="Email">Insert Your Email:</label></td>
485         <td style="width: 60%;"><input type="text" class="TextBox" name="Email" size="20" id="Email" value="<?php echo $User1Email; ?>" /></td>
486 </tr></table>
487 <table style="text-align: left;">
488 <tr style="text-align: left;">
489 <td style="width: 100%;">
490 <input type="hidden" name="act" value="userinfo" style="display: none;" />
491 <input type="hidden" name="update" value="now" style="display: none;" />
492 <input type="submit" class="Button" value="Save" />
493 <input class="Button" type="reset" />
494 </td></tr></table>
495 </form></td>
496 </tr>
497 <tr id="ProfileEnd" class="TableRow4">
498 <td class="TableRow4">&nbsp;</td>
499 </tr>
500 </table>
501 </div>
502 <?php @mysql_free_result($result); }
503 if($_POST['update']=="now") {
504 if($_POST['act']=="userinfo"&&
505         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
506         $query = query("select * from ".$Settings['sqltable']."members where `id`=%i", array($_SESSION['UserID']));
507         $result=mysql_query($query);
508         $num=mysql_num_rows($result);
509         $i=0;
510         $OldPassword=mysql_result($result,$i,"Password");
511         $OldHashType=mysql_result($result,$i,"HashType");
512         $OldJoined=mysql_result($result,$i,"Joined");
513         $OldSalt=mysql_result($result,$i,"Salt");
514         $UpdateHash = false; $NewSalt = salt_hmac(); 
515 if($OldHashType=="ODFH") { 
516         $YourPassword = sha1(md5($_POST['OldPass']));
517         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
518 if($OldHashType=="DF4H") { 
519         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
520         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
521 if($OldHashType=="iDBH"&&$UpdateHash!=true) { 
522         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
523         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
524 if($YourPassword!=$OldPassword) { $Error="Yes"; ?>
525 <div class="TableMessage" style="text-align: center;">Your old Password did not match.<br />&nbsp;</div>
526 <?php } if(strlen($_POST['Password'])=="30") { $Error="Yes"; ?>
527 <div class="TableMessage" style="text-align: center;">Your password is too big.<br />&nbsp;</div>
528 <?php } if(strlen($_POST['OldPass'])=="30") { $Error="Yes"; ?>
529 <div class="TableMessage" style="text-align: center;">Your old password is too big.<br />&nbsp;</div>
530 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
531 <div class="TableMessage" style="text-align: center;">Your passwords did not match.<br />&nbsp;</div>
532 <?php }
533         $NewDay=GMTimeStamp();
534         $NewIP=$_SERVER['REMOTE_ADDR'];
535         if ($Error!="Yes") {
536         setcookie("SessPass", $NewPassword, time() + (7 * 86400), $basedir);
537         $_POST['Email'] = @remove_spaces($_POST['Email']);
538         $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']));
539         mysql_query($querynewuserinfo); } } } }
540 ?>
541 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
542         $profiletitle = " - Updating Settings"; ?>
543 </td></tr>
544 <tr id="ProfileTitleEnd" class="TableRow4">
545 <td class="TableRow4">&nbsp;</td>
546 </tr></table></div><?php } ?>
547 </td></tr>
548 </table>