<?require ("global.php");?>
<?

$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }

$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }

$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);

if ($result)
{
    while ($r = mysql_fetch_array($result))
    {
	$event_name = $r['event_name'];
	$name = $r['name'];
	$standings_gc = $r['standings_gc'];
	$standings_now = $r['standings_now'];
	$standings_gc_url = $r['standings_gc_url'];
	$standings_now_url = $r['standings_now_url'];
	$standings_gc_header = $r['standings_gc_header'];
	$standings_now_header = $r['standings_thru'];
    }
    mysql_free_result($result);
}

?>

<html>
<head>
<title>OneTicker :: Standings</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>

<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>

<script type="text/javascript">banner(5);</script>

<form name="standings" action="standings_update.php" method="post">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">

<table border=0 cellspacing=2 cellpadding=2>
<tr><td colspan=2><div class=text>&nbsp;</div></td></tr>

<tr>
<td align=center><div class=text><b>Overall Standings</b></div></td>
<td align=center><div class=text><b>Current Standings</b></div></td>
</tr>

<tr valign=top>
<td align=center><div class=text>
<b>Header:</b>
<input class=blacktext type=text name="standings_gc_header" value="<? echo $standings_gc_header; ?>" size=40 maxlength=250>
<br><textarea class=blacktext name="standings_gc" cols=55 rows=6 wrap="virtual"><? echo $standings_gc; ?></textarea>
<br><b>Results URL:</b>
<input class=blacktext type=text name="standings_gc_url" value="<? echo $standings_gc_url; ?>" size=40 maxlength=250>
</div></td>
<td align=center><div class=text>
<b>Header:</b>
<input class=blacktext type=text name="standings_now_header" value="<? echo $standings_now_header; ?>" size=40 maxlength=250>
<br><textarea class=blacktext name="standings_now" cols=55 rows=6 wrap="virtual"><? echo $standings_now; ?></textarea>
<br><b>Results URL:</b>
<input class=blacktext type=text name="standings_now_url" value="<? echo $standings_now_url; ?>" size=40 maxlength=250>
</div></td>
</tr>

<tr><td colspan=2><div class=text>&nbsp;</div></td></tr>

<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="update standings for <? echo "$event_name $name"; ?>"></td>
</tr>

</table>
</form>

</body>
</html>
