<?php  header('Content-type: text/html; charset=utf-8'); ?>
<html>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<body bgcolor="white">
<?php
	extract($_REQUEST);

	include("scripts/sqlinfo.inc");
	mysql_connect($host, $user, $pass);
	mysql_selectdb("pyrot");
	
	if (!$prev)
		$result=mysql_query("select datum, tid, rubrik, plats, chief, info, medlemmar.namn from event, medlemmar where event.datum > now() and event.chief = medlemmar.col_id order by datum");
	else
		$result=mysql_query("select * from event where datum < now() order by datum desc limit " . $prev);
	
	if($r=mysql_fetch_array($result)){
		printf("<center><table width=400 border=0 cellspacing=0 cellpadding=0><tr><td><a href=\"events.php\"><b>Kommande skjutningar</b></a>
			</td><td valign=top align=right><a href=\"events.php?prev=10\"><b>10 senaste skjutningarna</b></a></td></tr><tr><td><br></td></tr><tr><td colspan=2><span class=\"header1\">Skjutningar</span></td></tr>");
		do {
			printf("<tr><td colspan=2><b>%s %s, %s</b></td></tr><tr><td colspan=2>Plats: %s</td></tr>"
				,$r["datum"], $r["tid"], $r["rubrik"], $r["plats"]);
			if($r["chief"]!="0")
				printf("<tr><td>Ansvarig: <a href=\"members.php?id=%s\">%s</a><tr><td colspan=2>%s<hr></td></tr>",
				 	$r["chief"], $r["medlemmar.namn"], $r["info"] );
			else
				printf("<tr><td>Ansvarig: Ingen &auml;nnu<tr><td colspan=2>%s<hr></td></tr>",
				 	$r["info"]
					);
		} while($r=mysql_fetch_array($result));
		printf("</table></center>");
	} else {
		printf("Inga skjutningar på gång");
	}
?>
</body>
</html>