-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtop.php
42 lines (36 loc) · 973 Bytes
/
top.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
include $_SERVER['DOCUMENT_ROOT']."/php/base.php";
$result = mysql_query("SELECT Username, PMID FROM ".$dbname.".Log");
$nrows=mysql_num_rows($result);
$array1=array();
$array2=array();
$array3=array();
while($row = mysql_fetch_array($result))
{
$array3[$row["Username"]]++;
if($array1[$row["Username"].";".$row["PMID"]]==0)
{
$array1[$row["Username"].";".$row["PMID"]]=1;
$array2[$row["Username"]]+=1;
}
}
arsort($array2);
$totalpapers=0;
$totaltags=0;
foreach ($array2 as $name => $npapers)
{
$totalpapers+=$npapers;
$totaltags+=$array3[$name];
}
?>
<h1> BrainSpell tag scores </h1>
<b><?php echo $totalpapers; ?> papers tagged</b><br/>
<b><?php echo $totaltags; ?> tags</b><br/>
<br/>
<table style="border:1px solid lightGrey">
<tr><td><b>Nickname</b></td><td><b>#papers</b></td><td><b>#tags</b></td></tr>
<?php
foreach ($array2 as $name => $npapers)
echo "<tr><td>".$name."</td><td>".$npapers."</td><td>".$array3[$name]."</td></tr>";
?>
</table>