Location: PHPKode > projects > Gatito Prediction League > gatito_pred_league/admin/res_enter.php
<?
include "../templates/connect_db.php";
//check user is logged in
@$h_score=$HTTP_GET_VARS["h_score"];
@$a_score=$HTTP_GET_VARS["a_score"];
@$game=$HTTP_GET_VARS["game"];
$query=mysql_query("SELECT * FROM users WHERE username='admin'") or die (mysql_error());
while ($row =@ mysql_fetch_array($query)) { 
	@$week ="$row[week]";};
@$funct=$HTTP_GET_VARS["funct"];
@$table="";
@$result="0";
if ($h_score==$a_score) {$result=1;};
if ($h_score>$a_score) {$result=2;};
if ($h_score<$a_score) {$result=3;};
if ($h_score=="9" AND $a_score=="9") {$result="9";};

if ($funct=="enter")
{
mysql_query("UPDATE checker SET h_score = '$h_score', a_score = '$a_score', result='$result'WHERE game='$game' AND week='$week'") or die (mysql_error());
};
if ($funct=="autocheck")
{include "autoResults.php";}

// display prediction to enter or edit;
	$query=mysql_query("SELECT * FROM checker WHERE week ='$week'") or die (mysql_error());
while ($row =@ mysql_fetch_array($query)) 
//display predictions for editing
{$table .="
<tr bgcolor='red'><form name='game' method='get' action='index.php'>
<td>$row[home_team]</td><td><input type='text' name='h_score' size='2' maxlength='2' value='$row[h_score]'/></td<td> v </td>
<td><input type=text name='a_score' size='2' maxlength='2' value='$row[a_score]'/></td><td>$row[away_team]</td>
<input type='hidden' name='week' value='$row[week]'/>
<input type='hidden' name='game' value='$row[game]'/>
<input type='hidden' name='funct' value='enter'/>
<input type='hidden' name='page_funct' value='res_enter'/>
<td><input type='submit' name='Submit' value='edit'></form></td></tr>";
	};
	echo "<table>$table</table>";

$table="";
	$query=mysql_query("SELECT * FROM checker WHERE week <'$week' AND result='9'") or die (mysql_error());
while ($row =@ mysql_fetch_array($query)) 
//display predictions for editing
{$table .="
<tr bgcolor='red'><form name='game' method='get' action='index.php'>
<td>$row[home_team]</td><td><input type='text' name='h_score' size='2' maxlength='2' value='$row[h_score]'/></td<td> v </td>
<td><input type=text name='a_score' size='2' maxlength='2' value='$row[a_score]'/></td><td>$row[away_team]</td>
<input type='hidden' name='week' value='$row[week]'/>
<input type='hidden' name='game' value='$row[game]'/>
<input type='hidden' name='funct' value='enter'/>
<input type='hidden' name='page_funct' value='res_enter'/>
<td><input type='submit' name='Submit' value='edit'></form></td></tr>";
	};
	echo "<h2>Postponed Games</h2><table>$table</table>";



echo "<a href=index.php?page_funct=res_enter&funct=autocheck>Auto check results from BBC RSS feed?</a>";

?>
Return current item: Gatito Prediction League