ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/www/src/template/links.php
Revision: 1.4
Committed: Sat Apr 3 00:39:51 2010 UTC (16 years, 7 months ago) by sf-dustfinger
Branch: MAIN
Changes since 1.3: +28 -2 lines
Log Message:
This commit adds the code to make the recent players feature work.  It will make the players online counter in the linkbar active and add a new page to list recent players.  It also adds icons to represent the operating systems and a few other minor details of the recent player list.

File Contents

# User Rev Content
1 sf-dustfinger 1.1 <div id="linkBar">
2 sf-dustfinger 1.2 <a href='index.html'>Home</a>
3     <a href='about.html'>About</a>
4     <a href='download.html'>Download</a>
5 sf-dustfinger 1.4 <a href='highscores.html'>High Scores</a>
6 sf-dustfinger 1.1 <a href='#'>Contact</a>
7 sf-dustfinger 1.4
8     <?php
9     $jsonScoresUnparsed = file_get_contents("recent.json");
10    
11     $jsonArray = json_decode($jsonScoresUnparsed);
12    
13     $timestamp = $jsonArray->date;
14     $version = $jsonArray->version;
15     $players = $jsonArray->data;
16    
17     $onlineCount = 0;
18     foreach($players as $player)
19     {
20     $lastLogout = $player[4];
21     if($lastLogout==null)
22     {
23     $onlineCount++;
24     }
25     else
26     {
27     break; //Stop searching.
28     }
29     }
30    
31     echo "<a style='float: right;' href='recent.html'>$onlineCount Players Online</a>\n";
32     ?>
33    
34 sf-dustfinger 1.1 </div>