Legends Website
Tutorial & Skiing
Legends FAQs
Player Configuration
Legends Teams List
How to Host
Server List Backup

New Maps
New Skins
New Voices
Player Scripts
Server Scripts & Mods

Legends Mapping Guide
Legends Scripting Guide
Creating Team Skins
Creating Voice Packs

Gameplay Guide
Legends Guide

Installation Instructions
Installer Script
Package Creator Scripts
Legends Distro Status

Legends Master Server Query on your website

Various efficient ways to get stats on your site.


    {{rss> 20 author date 5m }}

    PHP Master Query

    This PHP will check the XML data feed from this website, cache it and display the currently running Servers in a table. Just paste the chunk in your PHP where you want the table to appear, or save it as a file and use it as an include()

    It looks like this (with your styles)

    <? /* this chunk can go anywhere you want it to appear, or you can make it a page by adding <HTML><BODY> to the start and end */
    	error_reporting(0); // change to 1 to see detailed problems
    	$local_file = "legendsservers.xml";  //filename to save cache in
    	if(time() - filemtime($local_file) > 300 ) // get stats every 5 minutes and cache it
    		$url = "";
    		$xmldata = file_get_contents($url);
    		$file = fopen($local_file, "w"); 
    		fwrite($file, $xmldata);
        $p = xml_parser_create();
        $NUMSERVERS = $results[$index[NUMSERVERS][0]][value];
        $PUBDATE = $results[$index[PUBDATE][0]][value];
    	<table cellpadding="0" cellspacing="0" border="0" bgcolor="#999999"><tr><td>
    	<table cellpadding="2" cellspacing="1" border="0"><tr bgcolor="#ffffff"><td colspan="5"><h2>Legends Servers</h2>
    	<? echo($NUMSERVERS); ?> servers reported. <a href="" title="RSS currently populated Legends servers feed">Get Live Feed</a> - <a href="" title="show this list on your server">Get this PHP</a>
    	<br />Last Server Refresh: <? echo($PUBDATE); ?> (updated every 5 minutes)</td></tr>
    	<tr bgcolor="#ffffff"><td>Name</td><td>Players</td><td>Join</td><td>OS</td><td>Password</td></tr>
    	/* XML structure for
    	for ($i=0; $i < $NUMSERVERS; $i++) {
    		echo("\n<tr bgcolor='#ffffff'>");
    		echo("<td>" . htmlentities($results[$index[NAME][$i]][value]) . "</td>");
    		echo("<td>" . $results[$index[PLAYERS][$i]][value] . "/" . $results[$index[MAXPLAYERS][$i]][value] . "</td>");
    		echo("<td><a href='legends://" . $results[$index[IP][$i]][value] . ":" . $results[$index[PORT][$i]][value] . "' title='Instant join'>Connect</a></td>");
    		//echo("<td>" . $results[$index[VERSION][$i]][value] . "</td>");
    		echo("<td>" . $results[$index[OS][$i]][value] . "</td>");
    		echo("<td>" . $results[$index[PASSWORD][$i]][value] . "</td>");

    Javascript Master Query IFRAME

    This is an IFRAME as seen at the top of the Legends Forums. It has fade-in fade-out effects to cycle between all active servers and show how many players are on each. Very simple, will work on websites which can't use PHP. Has no impact on your host. You can specift background colour, link colour, font, font size - see the code and work it out.

    It looks like this

    <div style="background-color:#ffffff;"><iframe align="middle" name="rssfeed" width="95%" height="13" src="" marginheight="0" marginwidth="0" scrolling="no" frameborder="0" ></iframe></div>

    Javascript Master Query Ad Banner

    Javascript generated by Feedburner to display stats as a Banner. Has no impact on your host. Go here to get the code for Email Sigs, MySqace, Typepad, Wordpress etc. If you want to change the background to an image or anything like that you can just create your own feed at feedburner and put in our RSS url ( ).

    It looks like this

    <p style="margin-top:10px; margin-bottom:0; padding-bottom:0; text-align:center; line-height:0"><a href=""><img src="" alt="Active Legends Servers" style="border:0"></a></p><p style="margin-top:5px; padding-top:0; font-size:x-small; text-align:center"><a href=";w=1" onclick=", 'haHowto', 'width=520,height=600,toolbar=no,address=no,resizable=yes,scrollbars'); return false" target="_blank">&uarr; Grab this Headline Animator</a></p>
    server/php_masterquery.txt · Last modified: 2008/07/03 16:09 (external edit)