OSDN Git Service

Some more UTF-8 support thanks to people at php.net Manual. ^_^
[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: 11/20/2007 SVN 129 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="profilemain.php"||$File3Name=="/profilemain.php") {
18         require('index.php');
19         exit(); }
20
21 // Check if we can edit the profile
22 if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['CanEditProfile']=="no") {
23 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
24 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
25 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
26 if(!isset($_POST['update'])) { $_POST['update'] = null; }
27 ?>
28 <table class="Table3">
29 <tr style="width: 100%; vertical-align: top;">
30         <td style="width: 15%; vertical-align: top;">
31         <table id="ProfileLinks" class="Table1" style="width: 100%; float: left; vertical-align: top;">
32 <tr class="TableRow1">
33 <td class="TableRow1"><?php echo $ThemeSet['TitleIcon'] ?>Profile Settings</td>
34 </tr><tr class="TableRow2">
35 <td class="TableRow2">&nbsp;</td>
36 </tr><tr class="TableRow3">
37 <td class="TableRow3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit NotePad</a></td>
38 </tr><tr class="TableRow3">
39 <td class="TableRow3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit Profile</a></td>
40 </tr><tr class="TableRow3">
41 <td class="TableRow3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=signature",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit Signature</a></td>
42 </tr><tr class="TableRow3">
43 <td class="TableRow3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=avatar",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Edit Avatar</a></td>
44 </tr><tr class="TableRow4">
45 <td class="TableRow4">&nbsp;</td>
46 </tr></table><div>&nbsp;</div>
47 <table class="Table1" style="width: 100%; float: left; vertical-align: top;">
48 <tr class="TableRow1">
49 <td class="TableRow1"><?php echo $ThemeSet['TitleIcon'] ?>Board Settings</td>
50 </tr><tr class="TableRow2">
51 <td class="TableRow2">&nbsp;</td>
52 </tr><tr class="TableRow3">
53 <td class="TableRow3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=settings",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Board Settings</a></td>
54 </tr><tr class="TableRow3">
55 <td class="TableRow3"><a href="<?php echo url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']); ?>">Change User Info</a></td>
56 </tr><tr class="TableRow4">
57 <td class="TableRow4">&nbsp;</td>
58 </tr></table>
59 </td>
60         <td style="width: 85%; vertical-align: top;">
61 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
62 $updateact = url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
63 $profiletitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
64 @redirect("refresh",$basedir.url_maker($exfile['profile'],$Settings['file_ext'],"act=".$_GET['act'],$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile'],FALSE),"3");
65 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
66 $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
67 ?>
68 <div class="Table1Border">
69 <table class="Table1" style="width: 100%;">
70 <tr class="TableRow1">
71 <td class="TableRow1"><span style="float: left;">
72 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $updateact; ?>">Updating Settings</a>
73 </span><span style="float: right;">&nbsp;</span></td>
74 </tr>
75 <tr id="ProfileTitle" class="TableRow2">
76 <th class="TableRow2">Updating Settings</th>
77 </tr>
78 <tr class="TableRow3" id="ProfileUpdate">
79 <td class="TableRow3">
80 <div style="text-align: center;">
81 <br />Profile updated <a href="<?php echo $updateact; ?>">click here</a> to go back. ^_^<br />&nbsp;</div>
82 <?php } if($_GET['act']=="view") {
83 if($_POST['update']!="now") {
84 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
85 $result=mysql_query($query);
86 $num=mysql_num_rows($result);
87 $i=0;
88 $YourID=mysql_result($result,$i,"id");
89 $Notes=mysql_result($result,$i,"Notes");
90 $noteact = url_maker($exfile['profile'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
91 $notepadact = $noteact; $profiletitle = " ".$ThemeSet['TitleDivider']." NotePad";
92 ?>
93 <div class="Table1Border">
94 <table class="Table1" style="width: 100%;">
95 <tr class="TableRow1">
96 <td class="TableRow1"><span style="float: left;">
97 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $noteact; ?>">NotePad</a>
98 </span><span style="float: right;">&nbsp;</span></td>
99 </tr>
100 <tr id="ProfileTitle" class="TableRow2">
101 <th class="TableRow2">NotePad</th>
102 </tr>
103 <tr class="TableRow3" id="NotePadRow">
104 <td class="TableRow3">
105 <form style="display: inline;" method="post" action="<?php echo $notepadact; ?>"><div style="text-align: center;">
106 <label class="TextBoxLabel" for="NotePad">Your NotePad</label><br />
107 <textarea class="TextBox" name="NotePad" id="NotePad" style="width: 75%; height: 128px;" rows="10" cols="84"><?php echo $Notes; ?></textarea>
108 <input type="hidden" name="act" value="view" style="display: none;" />
109 <input type="hidden" name="update" value="now" style="display: none;" />
110 <br /><input type="submit" class="Button" value="Save" />&nbsp;<input class="Button" type="reset" />
111 </div></form></td>
112 </tr>
113 <tr id="ProfileEnd" class="TableRow4">
114 <td class="TableRow4">&nbsp;</td>
115 </tr>
116 </table>
117 </div>
118 <?php @mysql_free_result($result); }
119 if($_POST['update']=="now") {
120 if($_POST['act']=="view"&&
121         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
122         $_POST['NotePad'] = htmlspecialchars($_POST['NotePad'], ENT_QUOTES, $Settings['charset']);
123         $_POST['NotePad'] = remove_bad_entities($_POST['NotePad']);
124         $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 style="display: inline;" 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'] = stripcslashes(htmlspecialchars($_POST['Signature'], ENT_QUOTES));
169         //$_POST['Signature'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['Signature']);
170         //$_POST['Signature'] = @remove_spaces($_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 style="display: inline;" 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, $Settings['charset']);
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 style="display: inline;" 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(pre_strlen($mini)==2) { $showmin = $mini; }
311 if(pre_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)) { $dirnum = null;
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    closedir($handle); asort($themelist);
329    $themenum=count($themelist); $themei=0; 
330    while ($themei < $themenum) {
331    echo $themelist[$themei]."\n";
332    ++$themei; }
333 } ?></select></td>
334 </tr><tr style="text-align: left;">
335         <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>
336         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
337 <?php if($User1DST=="off"||$User1DST!="on") { ?>
338 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
339 <?php } if($User1DST=="on") { ?>
340 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
341 <?php } echo "\n" ?></select></td>
342 </tr></table>
343 <table style="text-align: left;">
344 <tr style="text-align: left;">
345 <td style="width: 100%;">
346 <input type="hidden" name="act" value="settings" style="display: none;" />
347 <input type="hidden" name="update" value="now" style="display: none;" />
348 <input type="submit" class="Button" value="Save" />
349 <input class="Button" type="reset" />
350 </td></tr></table>
351 </form></td>
352 </tr>
353 <tr id="ProfileEnd" class="TableRow4">
354 <td class="TableRow4">&nbsp;</td>
355 </tr>
356 </table>
357 </div>
358 <?php @mysql_free_result($result); }
359 if($_POST['update']=="now") {
360 if($_POST['act']=="settings"&&
361         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
362         $NewDay=GMTimeStamp();
363         $NewIP=$_SERVER['REMOTE_ADDR'];
364         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
365         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
366         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
367         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
368         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
369         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
370         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
371         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
372         $_SESSION['UserDST'] = $_POST['DST'];
373         $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']));
374         mysql_query($querynewskin); } } }
375 if($_GET['act']=="profile") {
376 if($_POST['update']!="now") {
377 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
378 $result=mysql_query($query);
379 $num=mysql_num_rows($result);
380 $i=0;
381 $YourID=mysql_result($result,$i,"id");
382 $User1Interests=mysql_result($result,$i,"Interests"); 
383 $User1Title=mysql_result($result,$i,"Title");
384 $User1Website=mysql_result($result,$i,"Website"); 
385 $User1Gender=mysql_result($result,$i,"Gender");
386 $User1TimeZone=mysql_result($result,$i,"TimeZone");
387 $BirthDay=mysql_result($result,$i,"BirthDay");
388 $BirthMonth=mysql_result($result,$i,"BirthMonth");
389 $BirthYear=mysql_result($result,$i,"BirthYear");
390 $User1Birthday = "MM/DD/YYYY";
391 if($BirthMonth!=null&&$BirthDay!=null&&$BirthYear!=null) { 
392         if($BirthYear=="0") { $BirthYear = "YYYY"; }
393         if($BirthDay=="0") { $BirthDay = "DD"; }
394         if($BirthMonth=="0") { $BirthMonth = "MM"; }
395         if(pre_strlen($BirthMonth)=="1") { $BirthMonth = "0".$BirthMonth; }
396         if(pre_strlen($BirthDay)=="1") { $BirthDay = "0".$BirthDay; }
397         $User1Birthday = $BirthMonth."/".$BirthDay."/".$BirthYear; }
398 $tsa_mem = explode(":",$User1TimeZone);
399 $TimeZoneArray = array("offset" => $User1TimeZone, "hour" => $tsa_mem[0], "minute" => $tsa_mem[1]);
400 $User1DST=mysql_result($result,$i,"DST");
401 $profileact = url_maker($exfile['profile'],$Settings['file_ext'],"act=profile",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
402 $profiletitle = " ".$ThemeSet['TitleDivider']." Profile Editor";
403 ?>
404 <div class="Table1Border">
405 <table class="Table1" style="width: 100%;">
406 <tr class="TableRow1">
407 <td class="TableRow1"><span style="float: left;">
408 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $profileact; ?>">Profile Editer</a>
409 </span><span style="float: right;">&nbsp;</span></td>
410 </tr>
411 <tr id="ProfileTitle" class="TableRow2">
412 <th class="TableRow2">Profile Editor</th>
413 </tr>
414 <tr class="TableRow3" id="ProfileEditor">
415 <td class="TableRow3">
416 <form style="display: inline;" method="post" action="<?php echo $profileact; ?>">
417 <table style="text-align: left;">
418 <tr style="text-align: left;">
419         <td style="width: 40%;"><label class="TextBoxLabel" for="Interests">Your Interests</label></td>
420         <td style="width: 60%;"><input type="text" class="TextBox" name="Interests" id="Interests" value="<?php echo $User1Interests; ?>" /></td>
421 </tr><tr style="text-align: left;">
422         <td style="width: 40%;"><label class="TextBoxLabel" for="Title">Your Title</label></td>
423         <td style="width: 60%;"><input type="text" class="TextBox" name="Title" id="Title" value="<?php echo $User1Title; ?>" /></td>
424 </tr><tr style="text-align: left;">
425         <td style="width: 40%;"><label class="TextBoxLabel" for="Website">Your Website</label></td>
426         <td style="width: 60%;"><input type="text" class="TextBox" name="Website" id="Website" value="<?php echo $User1Website; ?>" /></td>
427 </tr><tr style="text-align: left;">
428         <td style="width: 40%;"><label class="TextBoxLabel" for="EventDay">Your Birthday</label></td>
429         <td style="width: 60%;"><input maxlength="10" type="text" class="TextBox" name="EventDay" id="EventDay" value="<?php echo $User1Birthday; ?>" /></td>
430 </tr><tr style="text-align: left;">
431         <td style="width: 40%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
432         <td style="width: 60%;"><select id="YourOffSet" name="YourOffSet" class="TextBox">
433 <option selected="selected" value="<?php echo $TimeZoneArray['hour']; ?>">Old Value (<?php echo $TimeZoneArray['hour'].":00 hours"; ?>)</option>
434 <?php
435 $plusi = 1; $minusi = 12;
436 $plusnum = 13; $minusnum = 0;
437 while ($minusi > $minusnum) {
438 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n";
439 --$minusi; }
440 ?>
441 <option value="0">GMT +/- 0:00 hours</option>
442 <?php
443 while ($plusi < $plusnum) {
444 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n";
445 ++$plusi; }
446 ?></select></td>
447 </tr><tr style="text-align: left;">
448         <td style="width: 40%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
449         <td style="width: 60%;"><select id="MinOffSet" name="MinOffSet" class="TextBox">
450 <option selected="selected" value="<?php echo $TimeZoneArray['minute']; ?>">Old Value (<?php echo "0:".$TimeZoneArray['minute']." minutes"; ?>)</option>
451 <?php
452 $mini = 0; $minnum = 60;
453 while ($mini < $minnum) {
454 if(pre_strlen($mini)==2) { $showmin = $mini; }
455 if(pre_strlen($mini)==1) { $showmin = "0".$mini; }
456 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n";
457 ++$mini; }
458 ?></select></td>
459 </tr><tr style="text-align: left;">
460         <td style="width: 40%;"><label class="TextBoxLabel" for="YourGender">Your Gender:</label></td>
461         <td style="width: 60%;"><select id="YourGender" name="YourGender" class="TextBox">
462 <option selected="selected" value="<?php echo $User1Gender; ?>">Old Value (<?php echo $User1Gender; ?>)</option>
463 <option value="Male">Male</option>
464 <option value="Female">Female</option>
465 <option value="Unknow">Unknow</option>
466 </select></td>
467 </tr><tr style="text-align: left;">
468         <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>
469         <td style="width: 60%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
470 <?php if($User1DST=="off"||$User1DST!="on") { ?>
471 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
472 <?php } if($User1DST=="on") { ?>
473 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
474 <?php } echo "\n" ?></select></td>
475 </tr></table>
476 <table style="text-align: left;">
477 <tr style="text-align: left;">
478 <td style="width: 100%;">
479 <input type="hidden" name="act" value="profile" style="display: none;" />
480 <input type="hidden" name="update" value="now" style="display: none;" />
481 <input type="submit" class="Button" value="Save" />
482 <input class="Button" type="reset" />
483 </td></tr></table>
484 </form></td>
485 </tr>
486 <tr id="ProfileEnd" class="TableRow4">
487 <td class="TableRow4">&nbsp;</td>
488 </tr>
489 </table>
490 </div>
491 <?php @mysql_free_result($result); }
492 if($_POST['update']=="now") {
493 if($_POST['act']=="profile"&&
494         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
495         $_POST['Interests'] = htmlspecialchars($_POST['Interests'], ENT_QUOTES, $Settings['charset']);
496         $_POST['Interests'] = @remove_spaces($_POST['Interests']);
497         $_POST['Title'] = htmlspecialchars($_POST['Title'], ENT_QUOTES, $Settings['charset']);
498         $_POST['Title'] = @remove_spaces($_POST['Title']);
499         $_POST['Website'] = htmlentities($_POST['Website'], ENT_QUOTES, $Settings['charset']);
500         $_POST['Website'] = @remove_spaces($_POST['Website']);
501         if(!isset($_POST['EventDay'])) { $_POST['EventDay'] = null; }
502         if($_POST['EventDay']!=null) {
503         $BirthExpl = explode("/",$_POST['EventDay']);
504         if(count($BirthExpl)=="3") {
505         if(is_numeric($BirthExpl[0])&&is_numeric($BirthExpl[1])&&is_numeric($BirthExpl[2])) {
506         if(pre_strlen($BirthExpl[0])=="1") { $BirthExpl[0] = "0".$BirthExpl[0]; }
507         if(pre_strlen($BirthExpl[1])=="1") { $BirthExpl[1] = "0".$BirthExpl[1]; }
508         if(pre_strlen($BirthExpl[0])=="2"&&pre_strlen($BirthExpl[1])=="2"&&pre_strlen($BirthExpl[2])=="4") {
509         $BirthIn = mktime(12,12,12,$BirthExpl[0],$BirthExpl[1],$BirthExpl[2]);
510         $BirthMonth=GMTimeChange("m",$BirthIn,0,0,"off");
511         $BirthDay=GMTimeChange("d",$BirthIn,0,0,"off");
512         $BirthYear=GMTimeChange("Y",$BirthIn,0,0,"off"); }
513         if(pre_strlen($BirthExpl[0])!="2"||pre_strlen($BirthExpl[1])!="2"||pre_strlen($BirthExpl[2])!="4") { 
514                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
515         if (!is_numeric($BirthExpl[0])||!is_numeric($BirthExpl[1])||!is_numeric($BirthExpl[2])) { 
516                 $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
517         if(count($BirthExpl)!="3") { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; } }
518         if($_POST['EventDay']==null) { $BirthMonth="0"; $BirthDay="0"; $BirthYear="0"; }
519         if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
520         if($_POST['YourOffSet']>12) { $_POST['YourOffSet'] = "12"; }
521         if($_POST['YourOffSet']<-12) { $_POST['YourOffSet'] = "-12"; }
522         if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
523         if($_POST['MinOffSet']>59) { $_POST['MinOffSet'] = "59"; }
524         if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
525         $_POST['YourOffSet'] = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
526         $_SESSION['UserTimeZone'] = $_POST['YourOffSet'];
527         $_SESSION['UserDST'] = $_POST['DST'];
528         $NewDay=GMTimeStamp();
529         $NewIP=$_SERVER['REMOTE_ADDR'];
530         $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']));
531         mysql_query($querynewprofile); } } }
532 if($_GET['act']=="userinfo") {
533 if($_POST['update']!="now") {
534 $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
535 $result=mysql_query($query);
536 $num=mysql_num_rows($result);
537 $i=0;
538 $YourID=mysql_result($result,$i,"id");
539 $User1Email=mysql_result($result,$i,"Email"); 
540 $userinfoact = url_maker($exfile['profile'],$Settings['file_ext'],"act=userinfo",$Settings['qstr'],$Settings['qsep'],$prexqstr['profile'],$exqstr['profile']);
541 $profiletitle = " ".$ThemeSet['TitleDivider']." User Info Editer";
542 ?>
543 <div class="Table1Border">
544 <table class="Table1" style="width: 100%;">
545 <tr class="TableRow1">
546 <td class="TableRow1"><span style="float: left;">
547 <?php echo $ThemeSet['TitleIcon'] ?><a href="<?php echo $userinfoact; ?>">User Info Editer</a>
548 </span><span style="float: right;">&nbsp;</span></td>
549 </tr>
550 <tr id="ProfileTitle" class="TableRow2">
551 <th class="TableRow2">User Info Editer</th>
552 </tr>
553 <tr class="TableRow3" id="UserInfoEditor">
554 <td class="TableRow3">
555 <form style="display: inline;" method="post" action="<?php echo $userinfoact; ?>">
556 <table style="text-align: left;">
557 <tr style="text-align: left;">
558         <td style="width: 40%;"><label class="TextBoxLabel" for="OldPass">Insert old Password:</label></td>
559         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="OldPass" size="20" id="OldPass" /></td>
560 </tr><tr style="text-align: left;">
561         <td style="width: 40%;"><label class="TextBoxLabel" for="Password">Insert a Password:</label></td>
562         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="Password" size="20" id="Password" /></td>
563 </tr><tr style="text-align: left;">
564         <td style="width: 40%;"><label class="TextBoxLabel" for="RePassword">ReInsert a Password:</label></td>
565         <td style="width: 60%;"><input maxlength="30" type="password" class="TextBox" name="RePassword" size="20" id="RePassword" /></td>
566 </tr><tr style="text-align: left;">
567         <td style="width: 40%;"><label class="TextBoxLabel" for="Email">Insert Your Email:</label></td>
568         <td style="width: 60%;"><input type="text" class="TextBox" name="Email" size="20" id="Email" value="<?php echo $User1Email; ?>" /></td>
569 </tr></table>
570 <table style="text-align: left;">
571 <tr style="text-align: left;">
572 <td style="width: 100%;">
573 <input type="hidden" name="act" value="userinfo" style="display: none;" />
574 <input type="hidden" name="update" value="now" style="display: none;" />
575 <input type="submit" class="Button" value="Save" />
576 <input class="Button" type="reset" />
577 </td></tr></table>
578 </form></td>
579 </tr>
580 <tr id="ProfileEnd" class="TableRow4">
581 <td class="TableRow4">&nbsp;</td>
582 </tr>
583 </table>
584 </div>
585 <?php @mysql_free_result($result); }
586 if($_POST['update']=="now") {
587 if($_POST['act']=="userinfo"&&
588         $_SESSION['UserGroup']!=$Settings['GuestGroup']) {
589         $query = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i", array($_SESSION['UserID']));
590         $result=mysql_query($query);
591         $num=mysql_num_rows($result);
592         $i=0;
593         $OldPassword=mysql_result($result,$i,"Password");
594         $OldHashType=mysql_result($result,$i,"HashType");
595         $OldJoined=mysql_result($result,$i,"Joined");
596         $OldSalt=mysql_result($result,$i,"Salt");
597         $UpdateHash = false; $NewSalt = salt_hmac(); 
598 if($OldHashType=="ODFH") { 
599         $YourPassword = sha1(md5($_POST['OldPass']));
600         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
601 if($OldHashType=="DF4H") { 
602         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
603         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
604 if($OldHashType=="iDBH"&&$UpdateHash!=true) { 
605         $YourPassword = b64e_hmac($_POST['OldPass'],$OldJoined,$OldSalt,"sha1");
606         $NewPassword = b64e_hmac($_POST['Password'],$OldJoined,$NewSalt,"sha1"); }
607 if($YourPassword!=$OldPassword) { $Error="Yes"; ?>
608 <div class="TableMessage" style="text-align: center;">Your old Password did not match.<br />&nbsp;</div>
609 <?php } if(pre_strlen($_POST['Password'])=="30") { $Error="Yes"; ?>
610 <div class="TableMessage" style="text-align: center;">Your password is too big.<br />&nbsp;</div>
611 <?php } if(pre_strlen($_POST['OldPass'])=="30") { $Error="Yes"; ?>
612 <div class="TableMessage" style="text-align: center;">Your old password is too big.<br />&nbsp;</div>
613 <?php } if ($_POST['Password']!=$_POST['RePassword']) { $Error="Yes";  ?>
614 <div class="TableMessage" style="text-align: center;">Your passwords did not match.<br />&nbsp;</div>
615 <?php }
616         $NewDay=GMTimeStamp();
617         $NewIP=$_SERVER['REMOTE_ADDR'];
618         if ($Error!="Yes") { $_SESSION['UserPass']=$NewPassword;
619         if($cookieDomain==null) {
620         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir); }
621         if($cookieDomain!=null) {
622         if($cookieSecure==true) {
623         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
624         if($cookieSecure==false) {
625         @setcookie("SessPass", $NewPassword, time() + (7 * 86400), $cbasedir, $cookieDomain); } }
626         $_POST['Email'] = @remove_spaces($_POST['Email']);
627         $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']));
628         mysql_query($querynewuserinfo); } } } }
629 ?>
630 <?php if($_POST['update']=="now"&&$_GET['act']!=null) {
631         $profiletitle = " ".$ThemeSet['TitleDivider']." Updating Settings"; ?>
632 </td></tr>
633 <tr id="ProfileTitleEnd" class="TableRow4">
634 <td class="TableRow4">&nbsp;</td>
635 </tr></table></div><?php } ?>
636 </td></tr>
637 </table>
638 <div>&nbsp;</div>