SO 1.15gf
[specialops1.git] / pref.php
blob56881dd7b858e7f75439832fdd3914327a3c6905
1 <?php
2 require ('config.php');
3 require ('extfuncs.inc.php');
4 $level_restriction = INACTIVE_USER;
5 $require_login = true;
7 if (
8 isset ($_POST['submit'])
9 && (strlen ($_POST['email']) <= 50)
10 && (strlen ($_POST['email2']) <= 50)
11 && (strlen ($_POST['im']) <= 50)
12 && (strlen ($_POST['sig']) <= 160)
13 && (strlen ($_POST['quote']) <= 240)
16 $quote = nl2br (htmlentities ($_POST['quote']));
17 $ppp = ($_POST['ppp'] >= 5 && $_POST['ppp'] <= 100) ? intval ($_POST['ppp']) : 10;
18 $tpp = ($_POST['tpp'] >= 5 && $_POST['tpp'] <= 100) ? intval ($_POST['tpp']) : 10;
19 $timezone = intval ($_POST['timezone']);
20 foreach (array ('sig', 'quote', 'email', 'email2', 'im') as $varname)
21 $$varname = mysql_real_escape_string ($_POST[$varname]);
23 mysql_query ('UPDATE users SET
24 `email` = \''.htmlentities ($email).'\',
25 `email2` = \''.htmlentities ($email2).'\',
26 `AIM` = \''.htmlentities ($im).'\',
27 `sig` = \''.htmlentities ($sig).'\',
28 `quote` = \''.$quote.'\',
29 `timezone` = '.$timezone.',
30 `ppp` = '.$ppp.',
31 `tpp` = '.$tpp.'
32 WHERE `userid` = '.$userinfo['userid'].' LIMIT 1');
33 $userinfo = mysql_fetch_assoc (mysql_query ('SELECT * FROM `users` WHERE `userid` = '.$userinfo['userid']));
34 $updated = true;
35 $userinfo['timeoffset'] = $userinfo['timezone'] * 3600;
38 $page_name = 'User Settings';
39 require ('top.inc.php');
41 if (isset ($updated))
42 echo '<div class="c5">Preferences updated.</div>
45 $quote = str_replace ('<br />', '', $userinfo['quote']);
47 echo '<form method="post" action="'.$_SERVER['PHP_SELF'].urlpath().'">
48 <div class="c3">Display</div>
49 <table>
50 <tr class='.colour().'>
51 <td><label for="ppp">Posts per page</label></td>
52 <td><input type="text" name="ppp" id="ppp" value="'.$userinfo['ppp'].'" maxlength="3" size="3" /> (5-100)</td>
53 </tr>
54 <tr class='.colour().'>
55 <td><label for="tpp">Topics per page</label></td>
56 <td><input type="text" name="tpp" id="tpp" value="'.$userinfo['tpp'].'" maxlength="3" size="3" /> (5-100)</td>
57 </tr>
59 <tr class='.colour().'>
60 <td>Timezone:</td>
61 <td><select name="timezone">';
63 for ($hour = -12; $hour <= 13; $hour++)
65 echo '<option value="'.$hour.'"'.($userinfo['timezone'] == $hour ? ' selected="selected"' : '').'>GMT ';
66 if ($hour > 0)
67 echo '+';
68 if ($hour != 0)
69 echo $hour;
70 echo '</option>
73 echo '</select></td>
74 </tr>
75 </table>
77 <div class="c3">Profile</div>
78 <table>
79 <tr class='.colour().'>
80 <td>Private Email (max 50 chars):</td>
81 <td><input type="text" name="email" value="'.$userinfo['email'].'" maxlength="50" style="width:20em;display:block" /></td>
82 </tr>
83 <tr class='.colour().'>
84 <td>Public Email Address (max 50 chars):</td>
85 <td><input type="text" name="email2" value="'.$userinfo['email2'].'" maxlength="50" style="width:20em;display:block" /></td>
86 </tr>
87 <tr class='.colour().'>
88 <td>IM screenname (max 50 chars):</td>
89 <td><input type="text" name="im" value="'.$userinfo['AIM'].'" maxlength="50" style="width:20em;display:block" /></td>
90 </tr>
92 <tr class='.colour().'>
93 <td>Signature (max 160 chars):</td>
94 <td><textarea style="height:6em;width:90%;display:block" name="sig">'.$userinfo['sig'].'</textarea></td>
95 </tr>
96 <tr class='.colour().'>
97 <td>Quote (max 240 chars):</td>
98 <td><textarea style="height:6em;width:90%;display:block" name="quote">'.$quote.'</textarea></td>
99 </tr>
100 </table>
102 <div class="c4"><input type="submit" name="submit" value="Save Settings" accesskey="s" /> (Alt+S)</div>
103 </form>';
105 include('foot.php');