Source

Selador / halloffame.php

Full commit
<?php

/* halloffame.php - Front-end code displaying all halls of fame
 *
 * 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/>.
 **/

// Works but is specifically coded for the original Selador game at the moment, see end of file
@session_start();
header ("Content-Type: text/html; charset=UTF-8");
if (isset ($_POST['username']))
{
	  require_once ("php/auth.php");
	  ShowAuth();
}

if (isset ($_SESSION['me']))
{
	require_once ("uebersicht.php");
	die ();
}

$webtitle = "Ruhmeshalle";

require_once ("php/base/config.inc.php");

if (!IS_PORTAL && strcmp (MASTERURL, ""))
  header ("Location: ".MASTERURL."/halloffame.php");

require_once ("php/base/AuthDB.inc.php");


require_once("header_extern.php");
?>

</head>

<?php
if (isset ($_SESSION['authed_user']))
	require_once("menue_portal.php");
else
	require_once("menue.php");

?>
<div id="contentbox">
<div id="berichte-box">
	<div id="content">
	<h2>Statistiken und Hall of Fame</h2>
	<b>Laufende Welten:</b><br>
<?php

$authdb = new AuthDB;
$query = "select title,date_format(created, \"%d.%c.%Y\") as startdate,name from worlds where visible=1 and running=1 order by display_order";

if (!($res = $authdb->query ($query)))
	echo "Shit: ".$authdb->error ();
else
{
	while ($row = mysql_fetch_array ($res))
	{
		$path = WORLDSTATS_PATH."/".$row['name'];
		if (is_file ($path.".ps") && is_file ($path.".os"))
		{
			echo '<b>'.$row['title'].'</b>, gestartet am '.$row['startdate'].': <a href="worldstats.php?s=1&worldname='.$row['name'].'">Infos zur Welt</a>, <a href="worldstats.php?s=2&worldname='.$row['name'].'">Hall of Fame</a><br>';
		}
	}
}


echo '<p><b>Beendete Welten:</b></p>';

$query = "select title,date_format(created, \"%d.%c.%Y\") as startdate,name from worlds where running=0 and speed<24 order by created desc";

if (!($res = $authdb->query ($query)))
	echo "Shit: ".$authdb->error ();
else
{
	while ($row = mysql_fetch_array ($res))
	{
		$path = WORLDSTATS_PATH."/".$row['name'];
		if (is_file ($path.".ps") && is_file ($path.".os"))
		{
			echo '<b>'.$row['title'].'</b>, gestartet am '.$row['startdate'].': <a href="worldstats.php?s=1&worldname='.$row['name'].'">Infos zur Welt</a>, <a href="worldstats.php?s=2&worldname='.$row['name'].'">Hall of Fame</a><br>';
		}
	}
}

// If you aren't running the original Selador-Server you won't need these:
require_once("local/hof_add.php");
require_once("footer_outer.php");
?>