...

View Full Version : need help for my keno games



dxnitz
07-16-2012, 05:40 AM
hi,
I have a project that need me to make a php games and when i search google i found a keno games, i already edit it so it will not show error anymore but i dont know how to make a few function like show the winner picked number and show how many number that i choose , i already try for a few hours but got nothing

this is the code



<CENTER>
<P>
<?PHP
//
// Copyright 2001 Xavier Media Group
// http://www.xaviermedia.com/php/
//
// If you need help or have suggestions, please visit
// http://forum.xaviermedia.com/ or
// http://www.xaviermedia.com/php/keno.phtml
//

$n1 = "";
$n2 = "";
$n3 = "";
$n4 = "";
$n5 = "";
$n6 = "";
$n7 = "";
$n8 = "";
$n9 = "";
$n10 = "";
$n11 = "";
$n12 = "";
$n13 = "";
$n14 = "";
$n15 = "";
$n16 = "";
$n17 = "";
$n18 = "";
$n19 = "";
$n20 = "";

if(isset($_POST['action'])){
$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
$n3 = $_POST['n3'];
$n4 = $_POST['n4'];
$n5 = $_POST['n5'];
$n6 = $_POST['n6'];
$n7 = $_POST['n7'];
$n8 = $_POST['n8'];
$n9 = $_POST['n9'];
$n10 = $_POST['n10'];
$n11 = $_POST['n11'];
$n12 = $_POST['n12'];
$n13 = $_POST['n13'];
$n14 = $_POST['n14'];
$n15 = $_POST['n15'];
$n16 = $_POST['n16'];
$n17 = $_POST['n17'];
$n18 = $_POST['n18'];
$n19 = $_POST['n19'];
$n20 = $_POST['n20'];
}

$keno_numbers = array (
"0" => "",
"1" => "",
"2" => "",
"3" => "",
"4" => "",
"5" => "",
"6" => "",
"7" => "",
"8" => "",
"9" => "",
"10" => "",
"11" => "",
"12" => "",
"13" => "",
"14" => "",
"15" => "",
"16" => "",
"17" => "",
"18" => "",
"19" => "",
"20" => "");

if(isset($_POST['resetall'])){
if ($_REQUEST['resetall'] != "")
{
$player_numbers = array ();
$action = "";
}
}
if(isset($_POST['playrandom'])){

if ($_REQUEST['playrandom'] != "")
{
$player_numbers = array ();
$i = 0;
while ($i < 20)
{
$temp = rand(1,80);
if (!in_array($temp,$player_numbers))
{
$player_numbers[$i] = $temp;
$i++;
}
}
}
}

else
{
$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(isset($_POST['action'])){

$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 < 21)
{
if (in_array($keno_numbers[$i],$player_numbers))
$points++;
$i++;
}
?>

<STYLE>

.keno_blueline {
background-color: #E3E4F7;
}
.keno_pickednumber {
background-color: #F5F5C2;
}
.keno_winningandpickednumber {
background-color: #C1F5C2;
}
.keno_winningnumber {
background-color: #ECBCBC;
}
.keno_notpickednumber {

}
.keno_winningnumber, .keno_pickednumber, .keno_blueline, .keno_notpickednumber, .keno_winningandpickednumber { font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; }

</STYLE>

<script type="text/javascript">
<!--
function selectkeno(v)
{
if (document.getElementById('picked' + v).value == 0)
{
if (document.kenoform.n20.value > 0)
{
document.getElementById('keno' + document.kenoform.n20.value).className = document.getElementById('oldclass' + document.kenoform.n20.value).value;
document.getElementById('picked' + document.kenoform.n20.value).value = 0;
}
document.kenoform.n20.value = document.kenoform.n19.value
document.kenoform.n19.value = document.kenoform.n18.value
document.kenoform.n18.value = document.kenoform.n17.value
document.kenoform.n17.value = document.kenoform.n16.value
document.kenoform.n16.value = document.kenoform.n15.value
document.kenoform.n15.value = document.kenoform.n14.value
document.kenoform.n14.value = document.kenoform.n13.value
document.kenoform.n13.value = document.kenoform.n12.value
document.kenoform.n12.value = document.kenoform.n11.value
document.kenoform.n11.value = document.kenoform.n10.value
document.kenoform.n10.value = document.kenoform.n9.value
document.kenoform.n9.value = document.kenoform.n8.value
document.kenoform.n8.value = document.kenoform.n7.value
document.kenoform.n7.value = document.kenoform.n6.value
document.kenoform.n6.value = document.kenoform.n5.value
document.kenoform.n5.value = document.kenoform.n4.value
document.kenoform.n4.value = document.kenoform.n3.value
document.kenoform.n3.value = document.kenoform.n2.value
document.kenoform.n2.value = document.kenoform.n1.value
document.kenoform.n1.value = v
clicks++
document.getElementById('keno' + v).className = 'keno_pickednumber';
document.getElementById('picked' + v).value = 1;


}
}


//-->
</script>

<?

echo "<A NAME=keno></A><FORM METHOD=post ACTION=\"?page=keno&". time(). "#keno\" NAME=kenoform>\n";
echo "<P>Click on the numbers you would like to pick. You may only select 20 numbers.</P>\n";
echo "<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0>";
$n = 1;

for ($i = 0; $i < 8; $i++)
{
if ($i % 2 == 1)
echo "\n <TR CLASS=keno_blueline>";
else
echo "\n <TR>";

for ($j = 0; $j < 10; $j++)
{
$picked = 0;

if (in_array ($n, $player_numbers) && in_array($n, $keno_numbers))
{
$picked = 1;
$class = 'keno_winningandpickednumber';
$oldclass = 'keno_winningnumber';
}
else if (in_array ($n, $player_numbers))
{
$picked = 1;
$class = 'keno_pickednumber';
$oldclass = 'keno_notpickednumber';
}
else if (in_array($n, $keno_numbers))
{
$class = 'keno_winningnumber';
$oldclass = 'keno_winningnumber';
}
else
{
$class = 'keno_notpickednumber';
$oldclass = 'keno_notpickednumber';
}

echo " <TD ALIGN=center CLASS=". $class ." ID=\"keno$n\" onClick=\"javascript:selectkeno($n);\"><INPUT TYPE=hidden NAME=pickednumber[$n] VALUE=\"$picked\" ID=picked$n><INPUT TYPE=hidden NAME=oldclass[$n] VALUE=\"$oldclass\" ID=oldclass$n> &nbsp; <B>$n</B> &nbsp; </TD>\n";
$n++;
}
echo " </TR>\n";
}
echo " <TR><TD CLASS=keno_pickednumber>&nbsp;</TD><TD COLSPAN=9 CLASS=keno_notpickednumber>Number you picked</TD></TR>\n";
echo " <TR><TD CLASS=keno_winningnumber>&nbsp;</TD><TD COLSPAN=9 CLASS=keno_notpickednumber>Winning number you didn't have</TD></TR>\n";
echo " <TR><TD CLASS=keno_winningandpickednumber>&nbsp;</TD><TD COLSPAN=9 CLASS=keno_notpickednumber>Winning number you <B>did</B> pick!</TD></TR>\n";


echo "</TABLE>";

if(isset($_POST['action'])){
$again = " again!";
echo "<B>The winning numbers are:</B><BR>";
$w = 0;
while ($w < 20)
{
echo " &nbsp; $keno_numbers[$w]";
$w++;
if ($w == 10)
echo "<BR>";
}
echo "<BR><B>and you selected:</B><BR>";
$w = 0;
while ($w < 20)
{
echo " &nbsp; $player_numbers[$w]";
$w++;
if ($w == 10)
echo "<BR>";



}

echo "<P><B>You have $points winning numbers!</B></P>";

}



echo "<INPUT TYPE=hidden NAME=action VALUE=\"play\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n1 VALUE=\"". ($player_numbers[0] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n2 VALUE=\"". ($player_numbers[1] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n3 VALUE=\"". ($player_numbers[2] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n4 VALUE=\"". ($player_numbers[3] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n5 VALUE=\"". ($player_numbers[4] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n6 VALUE=\"". ($player_numbers[5] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n7 VALUE=\"". ($player_numbers[6] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n8 VALUE=\"". ($player_numbers[7] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n9 VALUE=\"". ($player_numbers[8] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n10 VALUE=\"". ($player_numbers[9] * 1) ."\"><BR>";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n11 VALUE=\"". ($player_numbers[10] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n12 VALUE=\"". ($player_numbers[11] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n13 VALUE=\"". ($player_numbers[12] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n14 VALUE=\"". ($player_numbers[13] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n15 VALUE=\"". ($player_numbers[14] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n16 VALUE=\"". ($player_numbers[15] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n17 VALUE=\"". ($player_numbers[16] * 1) ."\"> ";
echo "<INPUT TYPE=hidden text SIZE=2 MAXLENGTH=2 NAME=n18 VALUE=\"". ($player_numbers[17] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n19 VALUE=\"". ($player_numbers[18] * 1) ."\"> ";
echo "<INPUT TYPE=hidden SIZE=2 MAXLENGTH=2 NAME=n20 VALUE=\"". ($player_numbers[19] * 1) ."\"><BR>";
echo "<INPUT TYPE=submit NAME=play VALUE=\"Play KENO\"> <INPUT TYPE=submit NAME=playrandom VALUE=\"Pick 20 random numbers\"> <INPUT TYPE=submit NAME=resetall VALUE=\"Re-start\"></FORM>";
?>
</P>
</CENTER>

please help me how to make this game can show which number that i picked and win , how to show how many number that i pick and how to restart it..

really need help for my project please



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum