hey im new to this web site im looking for some help with my code its suppose to be a black jack game
im trying to make an array that can hold the value of the cards once the person presses the hit me button
please help me i havent fully develop code yet so you can ignore the comments code if you like thanks for looking
at it.
<html>
<head>
<title>poker dice</title>
<style type = "text/css">
body {
background: green;
color: tan;
}
</style>
</head>
<body>
<center>
<h1>Poker Dice</h1>
<form>
<?
$number = $_REQUEST["number"];
$statue = $_REQUEST["statue"];
$number2 = unserialize(urldecode($number));
//check to see if this is first time on the page.
if ($statue == null){
if ((!$cash) && (!$card_counter)){
Print "You will start out with a value of 100 dollars and points of 0.";
$cash = 100;
$card_counter = 0;
} // end if
Cards($number);
printPage();
}else if($statue == 1){
Cards2($number);
printPage();
// print "this is the second page";
}else if($statue == 2){
Cards3($number);
printPage();
// print "this is the second page";
}else if($statue == 3){
Cards4($number);
printPage();
// print "this is the second page";
}else if($statue == 4){
Cards5($number);
printPage();
// print "this is the second page";
}else if($statue == 5){
Cards6($number);
printPage();
// print "this is the second page";
}else if($statue == 6){
Cards7($number);
printPage();
// print "this is the second page";
}else if($statue == 7){
Cards8($number);
printPage();
// print "this is the second page";
}else{
Cards9($number);
printPage();
// print "this is the second page";
}
//rollDice();
if ($secondRoll == TRUE){
print "<h2>Second roll</h2>\n";
$secondRoll = FALSE;
evaluate();
} else {
print "<h2>First roll</h2>\n";
$secondRoll = TRUE;
} // end if
printStuff();
function Cards($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
$num2 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
echo $Cards[$num2];
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[0] = $Cards[$num1];
$cards_array[1] = $Cards[$num2];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print $cards_array[0];
print $cards_array[1];
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "1">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
// by using the number and requestinh it will store the value of that array.
//it good using a hidden box for this method.
//if ($Deck[$num1] == TRUE || $Deck[$num2] == TRUE) {
//}
//$CurrentHand = $Deck[$num1];
//$Deck = explode(",",$CurrentHand[0]);
//$Hit = array_shift($Deck);
//$Cards = implode(",",$Deck);
//if (isset($CurrentHand[1]))
// $PlayersHand = explode("~", $CurrentHand[1]);
//$PlayersHand[] = $Hit;
//$CardCount = 0;
/*$Aces = 0;
for ($i=0; $i<count($PlayersHand); ++$i) {
if (strpos($PlayersHand[$i], "Ace") !== FALSE)
++$Aces;
else if (strpos($PlayersHand[$i], "Two") !== FALSE)
$CardCount += 2;
else if (strpos($PlayersHand[$i], "Three") !== FALSE)
$CardCount += 3;
else if (strpos($PlayersHand[$i], "Four") !== FALSE)
$CardCount += 4;
else if (strpos($PlayersHand[$i], "Five") !== FALSE)
$CardCount += 5;
else if (strpos($PlayersHand[$i], "Six") !== FALSE)
$CardCount += 6;
else if (strpos($PlayersHand[$i], "Seven") !== FALSE)
$CardCount += 7;
else if (strpos($PlayersHand[$i], "Eight") !== FALSE)
$CardCount += 8;
else if (strpos($PlayersHand[$i], "Nine") !== FALSE)
$CardCount += 9;
else if (strpos($PlayersHand[$i], "Ten") !== FALSE)
$CardCount += 10;
else if (strpos($PlayersHand[$i], "Jack") !== FALSE)
$CardCount += 10;
else if (strpos($PlayersHand[$i], "Queen") !== FALSE)
$CardCount += 10;
else if (strpos($PlayersHand[$i], "King") !== FALSE)
$CardCount += 10;
}
$Cards = $Cards .implode("~", $PlayersHand);
if ($Aces > 0) {
for ($i=1; $i<=$Aces;++$i) {
if ($CardCount+11 <= 21)
$CardCount += 11;
else
$CardCount += 1;
}
}
if ($CardCount == 21)
$Cards = $Cards . "\nYou win!";
else if ($CardCount> 21)
$Cards = $Cards . "\nYou lose!";
//print $Deck;
print <<<HERE
</tr></td>
<tr>
<td colspan = "7">
<center>
<input type = "submit"
value = "play hand">
</center>
</td>
</tr>
</table>
HERE;*/
}//end function
function Cards2($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[2] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print $cards_array[0];
print $cards_array[1];
print $cards_array[2];
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "2">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards3($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[3] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print $cards_array[0];
print $cards_array[1];
print $cards_array[2];
print $cards_array[3];
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "3">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards4($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[4] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "4">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards5($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
$num2 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[5] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "5">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards6($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[6] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "6">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards7($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
$num2 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[7] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "7">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards8($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[8] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<form methods = "post"
action = "PokerFinal.php">
<input type = "submit"
value = "Hit Me">
<input type = "hidden"
name = "number"
value = "$serialCards">
<input type ="hidden"
name ="statue"
value = "8">
</form>
</center>
</td>
</tr>
</table>
HERE;
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function Cards9($number){
$Diamonds = array(
"Ace of Diamonds",
"Two of Diamonds",
"Three of Diamonds",
"Four of Diamonds",
"Five of Diamonds",
"Six of Diamonds",
"Seven of Diamonds",
"Eight of Diamonds",
"Nine of Diamonds",
"Ten of Diamonds",
"Jack of Diamonds",
"Queen of Diamonds",
"King of Diamonds");
$Clubs = array(
"Ace of Clubs",
"Two of Clubs",
"Three of Clubs",
"Four of Clubs",
"Five of Clubs",
"Six of Clubs",
"Seven of Clubs",
"Eight of Clubs",
"Nine of Clubs",
"Ten of Clubs",
"Jack of Clubs",
"Queen of Clubs",
"King of Clubs");
$Hearts = array(
"Ace of Hearts",
"Two of Hearts",
"Three of Hearts",
"Four of Hearts",
"Five of Hearts",
"Six of Hearts",
"Seven of Hearts",
"Eight of Hearts",
"Nine of Hearts",
"Ten of Hearts",
"Jack of Hearts",
"Queen of Hearts",
"King of Hearts");
$Spades = array(
"Ace of Spades",
"Two of Spades",
"Three of Spades",
"Four of Spades",
"Five of Spades",
"Six of Spades",
"Seven of Spades",
"Eight of Spades",
"Nine of Spades",
"Ten of Spades",
"Jack of Spades",
"Queen of Spades",
"King of Spades");
$Cards = array_merge($Diamonds, $Clubs);
$Cards = array_merge($Cards, $Hearts);
$Cards = array_merge($Cards, $Spades);
//$Deck = shuffle($Cards);
$num1 = rand(1,52);
echo $Cards[$num1];
//echo " ____ ";
// }else{
// echo "There is no cards being displayed.";
// }//close second if statement
// }//close first if statement
$cards_array[9] = $Cards[$num1];
//it take the object of a string and pass it as a array.
$serialCards = urlencode(serialize($cards_array));
print_r($cards_array);
print "<br>";
print $serialCards;
// print <<<HERE
// </tr></td>
// <tr>
// <td colspan = "5">
// <center>
//<form methods = "post"
// action = "PokerFinal.php">
//<input type = "submit"
// value = "Hit Me">
// <input type = "hidden"
// name = "number"
// value = "$serialCards">
// <input type ="hidden"
// name ="statue"
// value = "9">
//</form>
//</center>
// </td>
// </tr>
// </table>
//HERE;
print "No more HIT ME button";
print <<<HERE
</tr></td>
<tr>
<td colspan = "5">
<center>
<input type = "submit"
value = "roll again">
</center>
</td>
</tr>
</table>
HERE;
}
function printPage(){
}//end functon
//function rollDice(){
// global $die, $secondRoll, $keepIt;
//print "<table border = 1><td><tr>";
//for ($i = 0; $i < 5; $i++){
//if ($keepIt[$i] == ""){
//$die[$i] = rand(1, 6);
//} else {
//$die[$i] = $keepIt[$i];
//} // end if
//$theFile = "die" . $die[$i] . ".jpg";
//print out dice images
// print <<<HERE
// <td>
// <img src = "$theFile"
// height = 50
// width = 50><br>
//HERE;
//print out a checkbox on first roll only
// if ($secondRoll == FALSE){
// print <<<HERE
// <input type = "checkbox"
// name = "keepIt[$i]"
//value = $die[$i]>
//</td>
//HERE;
// } // end if
// } // end for loop
//print out submit button and end of table
//print <<<HERE
//</tr></td>
//<tr>
// <td colspan = "5">
// <center>
//<input type = "submit"
// value = "roll again">
//</center>
// </td>
//</tr>
//</table>
//HERE;
//} // end rollDice
function evaluate(){
global $die, $cash;
//set up payoff
$payoff = 0;
//subtract some money for this roll
$cash -= 2;
//count the dice
for ($theVal = 1; $theVal <= 6; $theVal++){
for ($dieNum = 0; $dieNum < 5; $dieNum++){
if ($die[$dieNum] == $theVal){
$numVals[$theVal]++;
} // end if
} // end dieNum for loop
} // end theVal for loop
//print out results
// for ($i = 1; $i <= 6; $i++){
// print "$i: $numVals[$i]<br>\n";
// } // end for loop
//count how many pairs, threes, fours, fives
$numPairs = 0;
$numThrees = 0;
$numFours = 0;
$numFives = 0;
for ($i = 1; $i <= 6; $i++){
switch ($numVals[$i]){
case 2:
$numPairs++;
break;
case 3:
$numThrees++;
break;
case 4:
$numFours++;
break;
case 5:
$numFives++;
break;
} // end switch
} // end for loop
//check for two pairs
if ($numPairs == 2){
print "You have two pairs!<br>\n";
$payoff = 1;
} // end if
//check for three of a kind and full house
if ($numThrees == 1){
if ($numPairs == 1){
//three of a kind and a pair is a full house
print "You have a full house!<br>\n";
$payoff = 5;
} else {
print "You have three of a kind!<br>\n";
$payoff = 2;
} // end 'pair' if
} // end 'three' if
//check for four of a kind
if ($numFours == 1){
print "You have four of a kind!<br>\n";
$payoff = 5;
} // end if
//check for five of a kind
if ($numFives == 1){
print "You got five of a kind!<br>\n";
$payoff = 10;
} // end if
//check for flushes
if (($numVals[1] == 1)
&& ($numVals[2] == 1)
&& ($numVals[3] == 1)
&& ($numVals[4] == 1)
&& ($numVals[5] == 1)){
print "You have a flush!<br>\n";
$payoff = 10;
} // end if
if (($numVals[2] == 1)
&& ($numVals[3] == 1)
&& ($numVals[4] == 1)
&& ($numVals[5] == 1)
&& ($numVals[6] == 1)){
print "You have a flush!<br>\n";
$payoff = 10;
} // end if
print "You bet 2<br>\n";
print "Payoff is $payoff<br>\n";
$cash += $payoff;
} // end evaluate
function printStuff(){
global $cash, $secondRoll;
print "Cash: $cash\n";
//store variables in hidden fields
print <<<HERE
<input type = "hidden"
name = "secondRoll"
value = "$secondRoll">
<input type = "hidden"
name = "cash"
value = "$cash">
HERE;
} // end printStuff
?>
</form>
</center>
</html>
[attachment deleted by admin]