Source

Selador / infoframe.php

<?php

/* infoframe.php - Front-end code for start page infoframe (but for global stats)
 *
 * Copyright (C) 2006, 2007, 2008 Kevin Read, Simone Schaefer
 *
 * This file is part of Selador, a browser-based fantasy strategy game
 *
 * This program is distributed under the terms of the GNU Affero General Public License.
 *
 *
 *   Selador is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   any later version.
 *
 *   Selador is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with Selador.  If not, see <http://www.gnu.org/licenses/>.
 **/

@header ("Content-Type: text/html; charset=UTF-8");
require_once ("php/base/config.inc.php");
require_once ("php/base/AuthDB.inc.php");

// This script can either be called as XML/iframe content provider,
// or it can be included.

// if it is included, authdb will already be there
if (!isset ($authdb))
{
	$authdb = new AuthDB ();

	$numtabs = 2;

	if (!isset ($_REQUEST['f']))
		$f = 1;
	else
	{
		$f = (int)$_REQUEST['f'];

		if (($f >  $numtabs) || ($f < 1))
			$f = 1;
	}
	echo '<html><head><link href="styles/public.css" rel="stylesheet" type="text/css"><body class="inhalt">';
	show_infoframe ($f);
	echo '</body></html>';
}


function show_infoframe ($f)
{
	global $authdb;
	$rowctr = 0;
	switch ($f)
	{
		case 1:
			$query = "select invitations, user from user where invitations>0 order by invitations desc limit 7";

			if ($res = $authdb->query ($query))
			{
				echo '<h3>Top-Einlader:</h3><br><table border="0">';
				while ($row = mysql_fetch_array ($res))
				{
					$rowctr++;
					echo '<tr><td>'.$rowctr.'.</td><td><b>'.$row['user'].'</b></td><td> mit '.$row['invitations'].' Einladungen</td></tr>';
				}
				echo "</table>";
			}
			break;
	}
}

?>