diff --git a/php/profile.php b/php/profile.php
new file mode 100644
index 0000000..b399067
--- /dev/null
+++ b/php/profile.php
@@ -0,0 +1,266 @@
+
+
+"|", "["=>"{", "]"=>"}", "~"=>"^");
+ $usernameCanonical = strtr($username, $ircLowerSymbols);
+ $usernameCanonical = strtolower($usernameCanonical);
+ } else {
+ $username = '';
+ $usernameCanonical = '';
+ }
+?>
+
+
+ Players · TriviaTime
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+prepare('select
+ tl.username as usrname,
+ sum(tl2.t * (tl2.n /
+ (select sum(num_answered)
+ from triviauserlog
+ where username_canonical=:username))
+ ) as count,
+ sum(tl2.p * (tl2.n /
+ (select sum(num_answered)
+ from triviauserlog
+ where username_canonical=:username))
+ ) as score,
+ (select sum(points_made) from triviauserlog t3 where username_canonical=:username) as points,
+ (select sum(num_answered) from triviauserlog t4 where username_canonical=:username) as q_asked,
+ (select num_editted from triviausers where username_canonical=:username) as num_e,
+ (select num_editted_accepted from triviausers where username_canonical=:username) as num_e_accepted,
+ (select num_questions_added from triviausers where username_canonical=:username) as num_q,
+ (select num_questions_accepted from triviausers where username_canonical=:username) as num_q_accepted,
+ (select num_reported from triviausers where username_canonical=:username) as num_r
+ from (select
+ tl3.id as id2,
+ tl3.average_time * 1.0 as t,
+ tl3.average_score * 1.0 as p,
+ tl3.num_answered * 1.0 as n
+ from triviauserlog tl3
+ ) tl2
+ inner join triviauserlog tl
+ on tl.username_canonical=:username
+ and tl.id=tl2.id2
+ ');
+ $q->execute(array(':username'=>$usernameCanonical));
+ if ($q === false) {
+ die("Error: database error: table does not exist\n");
+ } else {
+ $result = $q->fetchAll();
+ if(sizeOf($result) > 0) {
+ $result = $result[0];
+ }
+
+ if(is_null($result['usrname'])) {
+ $result['usrname'] = "Not found";
+ $result['count'] = 0;
+ $result['score'] = 0;
+ $result['points'] = 0;
+ $result['q_asked'] = 0;
+ $result['num_e'] = 0;
+ $result['num_e_accepted'] = 0;
+ $result['num_q'] = 0;
+ $result['num_q_accepted'] = 0;
+ $result['num_r'] = 0;
+
+ }
+ }
+ } else {
+ if(isset($err)) {
+ die($err);
+ }
+ }
+?>
+
+
+
Profile and user summary.
+
+
+
+
+
+
+
+
Averages
+
+
+
+ | Average Time/Question* |
+ Average Points/Question* |
+
+
+
+';
+ echo '' . number_format($result['count'],2) . ' | ';
+ echo '' . number_format($result['score'],2) . ' | ';
+ echo '';
+ }
+ }
+?>
+
+
+
+
+
+
+
Totals
+
+
+
+ | Total Points |
+ Number Answered* |
+
+
+
+';
+ echo '' . number_format($result['points'],0) . ' | ';
+ echo '' . number_format($result['q_asked'],0) . ' | ';
+ echo '';
+ }
+ }
+?>
+
+
+
+
+
+
+
Contributions
+
+
+
+ | Number Edited |
+ Edits Accepted |
+ Questions Added |
+ Questions Accepted |
+ Reports Made |
+
+
+
+';
+ echo '' . number_format($result['num_e'],0) . ' | ';
+ echo '' . number_format($result['num_e_accepted'],0) . ' | ';
+ echo '' . number_format($result['num_q'],0) . ' | ';
+ echo '' . number_format($result['num_q_accepted'],0) . ' | ';
+ echo '' . number_format($result['num_r'],0) . ' | ';
+ echo '';
+ }
+ }
+?>
+
+
+
+
+
+
+
+
* These stats do not include KAOS
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/php/stats.php b/php/stats.php
index fc929ee..139ad87 100644
--- a/php/stats.php
+++ b/php/stats.php
@@ -171,7 +171,7 @@
foreach($result as $key=>$res) {
echo '';
echo '| ' . ($key+1) . ' | ';
- echo '' . $res['username'] . ' | ';
+ echo '' . $res['username'] . ' | ';
echo '' . number_format($res['points'],0) . ' | ';
echo '
';
}
@@ -212,7 +212,7 @@
foreach($result as $key=>$res) {
echo '';
echo '| ' . ($key+1) . ' | ';
- echo '' . $res['username'] . ' | ';
+ echo '' . $res['username'] . ' | ';
echo '' . number_format($res['points'],0) . ' | ';
echo '
';
}
@@ -253,7 +253,7 @@
foreach($result as $key=>$res) {
echo '';
echo '| ' . ($key+1) . ' | ';
- echo '' . $res['username'] . ' | ';
+ echo '' . $res['username'] . ' | ';
echo '' . number_format($res['points'],0) . ' | ';
echo '
';
}
@@ -282,5 +282,3 @@