3 * User Invites and Points FAQ
5 * @author Ant P <p@cpi.merseine.nu>
6 * @license file://COPYING
12 SO2
::$Page->title
= 'Invites and Points Status';
14 if ( ! (SO2
::$User instanceof User_Authenticated
) ) {
15 SO2
::$Page->message(Page
::ERR_LOGIN
);
17 SO2
::$Page->pageheader();
19 echo "<h2>User Invites</h2>\n";
21 define('REG_URI', 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']).'/register.php');
23 $q = SO2
::$DB->query('SELECT data FROM things WHERE what = \'invite\' AND userid = @userid')->fetchAll(PDO
::FETCH_COLUMN
);
26 foreach ( $q as $code ) {
27 printf(' <li><a href="'.REG_URI
.'?user=%d;code=%s">'.REG_URI
.'?user=%1$d;code=%2$s</a></li>'."\n",
28 SO2
::$User->userid
, $code);
30 echo "</ul>\n<p>Users registering through one of these links start off with 1 point instead of 0. You can have a maximum of 5 invites at any one time.</p>\n";
32 echo "<p>You have no invites at the moment.\n</p>";
35 $q = SO2
::$DB->query('SELECT userid FROM users WHERE referrer = @userid')->fetchAll(PDO
::FETCH_COLUMN
);
37 echo "<h3>Invited Users:</h3>\n<ul>\n";
38 foreach ( $q as $tmp ) {
39 echo ' <li>',SO2
::$Page->namelink($tmp),"</li>\n";
43 for ( $i = max(SO2
::$User->points +
1, pow(SO2
::$User->invites
, 2)); floor(sqrt($i)) != sqrt($i); $i++
);
47 <p
>You have
<?php
echo SO2
::$User->points ?
> points
. Points to next invite
: <?php
echo $i - SO2
::$User->points ?
>.</p
>