Fixes for mysql 5.0.15 breaking stuff
[specialops2.git] / user.php
blob0f926da2a0e207a9006cf339ad47717d1bb9ea01
1 <?php
2 // $Id$
4 $prefetch = array('`points`', '`last_active_date`', '`register_date`', '`sig`', '`quote`', '`reg_email`', '`public_email`', '`private_email`', '`useragent`',
5 'INET_NTOA(`last_login_ip`) AS `last_login_ip`', 'INET_NTOA(`last_ip`) AS `last_ip`', 'INET_NTOA(`reg_ip`) AS `reg_ip`');
7 require 'con.php';
8 $page->title = 'User Details';
10 if ( ! ($user instanceof authuser) )
11 $page->errorfooter('login');
13 $uid = isset($_GET['id']) ? intval($_GET['id']) : $user->userid;
15 if ( $user->userid != $uid && $DB->query('SELECT `userid` FROM `users` WHERE `userid` = '.$uid)->num_rows == 0 )
16 $page->errorfooter('userid');
18 if ( $user->userid == $uid ) {
19 $page->title = 'Your Details';
20 $user->userheader();
21 $user2 = $user;
23 echo
24 '<fieldset style="float:right" class="content"><legend>Options Menu</legend>
25 <ul>
26 <li><a href="theme">Edit your theme</a></li>
27 <li><a href="options">Change settings and profile</a></li>
28 <li><a href="passwd">Change your password</a></li>
29 <li><a href="userlist">See user list</a></li>
30 <li><a href="userlist?show=banned">See banned user list</a></li>
31 <li><a href="invites">Check your invite list</a></li>
32 </ul>
33 </fieldset>',"\n";
35 } else {
36 $user2 = new reguser($uid, $prefetch);
37 $page->title = 'User Details for '.$user2->alias;
38 $user->userheader();
39 if ( LVL_RESTRICTED == $user2->level && LVL_ADMIN <= $user->level && isset($_POST['activate']) ) {
40 $user2->level = LVL_USER;
41 echo '<p class="notice">User account has been activated.</p>';
45 echo "<dl>\n",
46 '<dt>User Name</dt>
47 <dd><strong>',$user2->alias,'</strong></dd>
48 <dt>Account ID</dt>
49 <dd>',$user2->userid,'</dd>
50 <dt>Level</dt>
51 <dd>',$user2->level,': ';
53 switch ( round($user2->level-5, -1) ) {
54 case LVL_USER:
55 echo 'Normal User'; break;
56 case LVL_ADMIN:
57 echo 'Administrator'; break;
58 case LVL_DEV:
59 echo '∞'; break;
61 case LVL_RESTRICTED:
62 default:
63 echo 'Restricted Account'; break;
66 echo '</dd>
67 <dt>Points</dt>
68 <dd>',$user2->points,'</dd>
69 <dt>Last Active</dt>
70 <dd>',$user->fdate($user2->last_active_date),'</dd>
71 <dt>Registration Date</dt>
72 <dd>',$user->fdate($user2->register_date),'</dd>
73 <dt>Signature</dt>
74 <dd>',nl2br(htmlspecialchars($user2->sig)),'</dd>
75 <dt>Quote</dt>
76 <dd>',nl2br(htmlspecialchars($user2->quote)),'</dd>
77 <dt>Public E-mail Address</dt>
78 <dd>',$user2->public_email,'</dd>
79 <dt>Browser</dt>
80 <dd>',htmlspecialchars($user2->useragent),'</dd>
81 </dl>';
83 //Admin stuff
84 if ( LVL_ADMIN <= $user->level ) {
85 echo "\n",
86 '<p class="notice">Administrator Information</p>',"\n",
87 "<dl>\n",
88 '<dt>Private E-Mail Address</dt>',"\n",
89 ' <dd>',$user2->private_email,"</dd>\n",
90 '<dt>Signup E-Mail Address</dt>',"\n",
91 ' <dd>',$user2->reg_email,"</dd>\n";
93 $fields = array(
94 'Last Login From' => $user2->last_login_ip,
95 'Last Active From' => $user2->last_ip,
96 'Signed Up From' => $user2->reg_ip
99 foreach ( $fields as $title => $addr )
100 echo '<dt>',$title,"</dt>\n",
101 "\t<dd>",( is_null($addr) ? 'Unknown Address' : $addr.' &rarr; '.gethostbyaddr($addr) ),"</dd>\n";
103 echo "</dl>\n";
105 if ( LVL_RESTRICTED >= $user2->level )
106 echo "\n",
107 '<form action="',$_SERVER['PHP_SELF'],'?id=',$user2->userid,'" method="post" class="info">',"\n",
108 ' <p>This user is currently pending confirmation:',"\n",
109 ' <input type="submit" name="activate" value="Activate Account"/></p>',"\n",
110 '</form>';
113 $page->pagefooter();