<?PHP
//
// Copyright 2001 Xavier Media Group
// http://www.xaviermedia.com/php/
//
// If you need help or have suggestions, please visit
// http://www.xaviermedia.com/forum/index.php or
// http://www.xaviermedia.com/php/keno.phtml
//
$keno_numbers = array (
"0" => "",
"1" => "",
"2" => "",
"3" => "",
"4" => "",
"5" => "",
"6" => "",
"7" => "",
"8" => "",
"9" => "",
"10" => "",
"11" => "",
"12" => "",
"13" => "",
"14" => "",
"15" => "",
"16" => "",
"17" => "",
"18" => "",
"19" => "",
"20" => "");
$player_numbers = array (
"0" => "$n1",
"1" => "$n2",
"2" => "$n3",
"3" => "$n4",
"4" => "$n5",
"5" => "$n6",
"6" => "$n7",
"7" => "$n8",
"8" => "$n9",
"9" => "$n10",
"10" => "$n11",
"11" => "$n12",
"12" => "$n13",
"13" => "$n14",
"14" => "$n15",
"15" => "$n16",
"16" => "$n17",
"17" => "$n18",
"18" => "$n19",
"19" => "$n20");
if ($action == "play")
{
$i = 0;
while ($i < 20)
{
$temp = rand(1,80);
if (!in_array($temp,$keno_numbers))
{
$keno_numbers[$i] = $temp;
$i++;
}
}
sort($keno_numbers);
sort($player_numbers);
}
$i = 0;
$points = 0;
while ($i < 20)
{
if (in_array($keno_numbers[$i],$player_numbers))
$points++;
$i++;
}
echo "<TABLE>";
$i = 0;
$n = 1;
while ($i < 8)
{
if ($i % 2 == 1)
echo " <TR BGCOLOR=\"#C1C2F5\">";
else
echo " <TR>";
$j = 0;
while ($j < 10)
{
if (in_array($n, $keno_numbers))
echo "<TD BGCOLOR=\"#ECBCBC\">";
else
echo "<TD>";
echo "<FONT FACE=\"verdana, arial, helvetica\" SIZE=2>";
if (in_array ($n, $player_numbers))
echo "<B> $n </B>";
else
echo " $n ";
echo "</FONT></TD>";
$j++;
$n++;
}
$i++;
}
echo "</TABLE>";
if ($action == "play")
{
echo "<B>The winning numbers are:</B><BR>";
$w = 0;
while ($w < 20)
{
echo " $keno_numbers[$w]";
$w++;
if ($w % 10 == 0)
echo "<BR>";
}
echo "<B>and you selected:</B><BR>";
$w = 0;
while ($w < 20)
{
echo " $player_numbers[$w]";
$w++;
if ($w % 10 == 0)
echo "<BR>";
}
echo "<B>You found $points numbers!</B>";
}
echo "<FORM METHOD=post ACTION=\"$PHP_SELF?action=play&". time(). "\">Select 20 numbers between 1 and 80:<BR>";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n1 VALUE=\"$player_numbers[0]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n2 VALUE=\"$player_numbers[1]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n3 VALUE=\"$player_numbers[2]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n4 VALUE=\"$player_numbers[3]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n5 VALUE=\"$player_numbers[4]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n6 VALUE=\"$player_numbers[5]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n7 VALUE=\"$player_numbers[6]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n8 VALUE=\"$player_numbers[7]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n9 VALUE=\"$player_numbers[8]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n10 VALUE=\"$player_numbers[9]\"><BR>";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n11 VALUE=\"$player_numbers[10]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n12 VALUE=\"$player_numbers[11]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n13 VALUE=\"$player_numbers[12]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n14 VALUE=\"$player_numbers[13]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n15 VALUE=\"$player_numbers[14]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n16 VALUE=\"$player_numbers[15]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n17 VALUE=\"$player_numbers[16]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n18 VALUE=\"$player_numbers[17]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n19 VALUE=\"$player_numbers[18]\"> ";
echo "<INPUT TYPE=text SIZE=3 MAXLENGTH=2 NAME=n20 VALUE=\"$player_numbers[19]\"><BR>";
echo "<INPUT TYPE=submit VALUE=\"Play KENO\"></FORM>";
?>