Did something with the DTD thing
[specialops2.git] / points.php
blob37fa8a7b8df2735f5cdd65ef79d5450d4aba74fe
1 <?php
2 /**
3 * User Invites and Points FAQ
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
7 * @version $Id$
8 */
10 $prefetch = array('`points`', '`invites`');
11 require 'con.php';
12 $page->title = 'Stuff Control Panel';
14 if ( ! ($user instanceof User_Authenticated) ) {
15 $page->errorfooter('login');
18 $user->userheader();
21 <h2>Points</h2>
22 <p class="info">You have <?php echo $user->points ?> points.</p>
23 <h3>Getting</h3>
24 <ul>
25 <li>Topics: +2 points each</li>
26 <li>Posts: +1 point each</li>
27 </ul>
28 <h3>Doing</h3>
29 <ul>
30 <li>1 point: Access to the registered users-only areas of site.</li>
31 <li>10 points: You get to mark messages giving the poster ±1 point. You can't mark your own messages.</li>
32 <li>100 points: Message marks increase to 2 points.</li>
33 <li>1000 points: Message marks increase to 3 points.</li>
34 <li>10000 points: Marks are 4 points plus you can use HTML in posts.</li>
35 </ul>
37 <h2>User Invites</h2>
39 <?php
40 if ( !defined('INVITE_ONLY') ) {
41 echo '<p class="info">Invites are currently disabled.</p>',"\n";
42 } else {
43 $urllist = $DB->query('SELECT `data` FROM `things` WHERE `what` = "invite" AND `userid` = @userid');
44 if ( $urllist->num_rows ) {
45 echo "<h3>Invite Links:</h3>\n<ul>\n";
47 while ( list($code) = $urllist->fetch_row() ) {
48 printf(' <li><a href="register?user=%d;code=%s">http://%s%s/register?user=%1$d;code=%2$s</a></li>'."\n",
49 $user->userid, $code, $_SERVER['HTTP_HOST'], dirname($_SERVER['REQUEST_URI']));
52 echo "</ul>\n",
53 '<p>These links are only valid for one registration, and you can only have a maximum of 5 at any time.</p>',"\n";
56 $i = max($user->points, pow($user->invites, 2)); // Set "invite level"
57 do { // Count up to next level
58 $i++;
59 } while ( floor(sqrt($i)) != sqrt($i) );
61 echo '<p class="info">Points to next invite: ',($i - $user->points),"</p>\n";
63 $userlist = $DB->query('SELECT `userid`, `alias` FROM `users` WHERE `referrer` = @userid');
64 if ( $userlist->num_rows ) {
65 echo "<h3>You have invited:</h3>\n<ol>\n";
67 while ( $user2 = $userlist->fetch_row() ) {
68 echo ' <li>',$user->namelink($user2[0], $user2[1]),"</li>\n";
71 echo "</ol>\n";
76 <?php
77 $page->pagefooter();