changed the thingers
[specialops2.git] / admin.php
blob877ac719c72a002045a85d0e9f28a919d75372cf
1 <?php
2 // $Id$
4 $default_password = null;
6 require 'con.php';
7 $page->title = 'Admin Control Panel';
9 if ( ! ($user instanceof authuser) )
10 $page->errorfooter('login');
12 $user->userheader();
14 if ( isset($_POST['passreset']) ) {
15 if ( !is_numeric($_POST['p_user']) )
16 list($user2) = $DB->query('SELECT `userid` FROM `users` WHERE `alias` = \''.$DB->escape_string($_POST['p_user']).'\'')
17 ->fetch_row();
18 else
19 $user2 = intval($_POST['p_user']);
20 if ( $user2 ) {
21 $user2 = new reguser($user2);
22 $user2->password = $default_password;
23 echo '<p class="notice">Password for user ',$user2->alias,' is now "',var_dump($default_password),'".</p>';
24 } else
25 echo '<p class="error">That user doesn\'t seem to exist.</p>';
29 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
30 <fieldset><legend>Password reset thing</legend>
31 <p>Resets the user's password to a random number.</p>
32 <label>Username or userid: <input type="text" name="p_user"/></label>
33 <p><button type="submit" name="passreset" value="1">Reset</button></p>
34 </fieldset>
35 </form>
37 <?php
38 $q = $DB->query('SELECT `userid`, `code` FROM `invites` ORDER BY `userid`');
39 while ( list($userid, $code) = $q->fetch_row() )
40 $invites[$userid][] = $code;
43 <fieldset><legend>User invites</legend>
44 <dl>
45 <?php
46 foreach ( $invites as $userid => $i ) {
47 echo '<dt>',$user->namelink($userid),"</dt>\n";
48 foreach ( $i as $code )
49 printf(' <dd><a href="register?user=%d;code=%s">http://%s%s/register?user=%1$d;code=%2$s</a></dd>'."\n",
50 $userid, $code, $_SERVER['HTTP_HOST'], dirname($_SERVER['REQUEST_URI']));
53 </dl>
54 </fieldset>
56 <?php
57 $page->pagefooter();