<?php
ob_start();
include("config.php"); 
	if(! check_login()) { 
	exit;
	}

$dbres	=	mysql_query("SELECT *,UNIX_TIMESTAMP(`gevangenis`) AS `gevangenis`,0 FROM `gebruiker` WHERE `login`='{$data->login}'");
$data	=	mysql_fetch_object($dbres);

	if($data->gevangenis + $data->gevangenistijd > time()){
	header("Location: netwerken-gevangenis.php"); 
	exit;
	}

?>

<html>
<head>
<title>Ultimatecrime</title>
<link rel="stylesheet" type="text/css" href="style_general.css">
</head>
<body background="layout/images/layout_12.gif" bgproperties="fixed">
<br>
<br>
<br>

<?php

	function nieuweKaart(){

	$kaart				=	mt_rand(1,13); 
	$soort				=	mt_rand(1,4); 

		if($soort == 1){

		$soort			=	"harten";

		} else if($soort == 2){

		$soort			=	"schoppen";

		} else if($soort == 3){

		$soort			=	"ruiten";

		} else if($soort == 4){

		$soort			=	"klaveren";

		}


		if($kaart == 1){

		$punten			=	"o";

		} else if($kaart == 2){

		$punten			=	2;

		} else if($kaart == 3){

		$punten			=	3;

		} else if($kaart == 4){

		$punten			=	4;

		} else if($kaart == 5){

		$punten			=	5;

		} else if($kaart == 6){

		$punten			=	6;

		} else if($kaart == 7){

		$punten			=	7;

		} else if($kaart == 8){

		$punten			=	8;

		} else if($kaart == 9){

		$punten			=	9;

		} else if($kaart == 10){

		$punten			=	10;

		} else if($kaart == 11){

		$punten			=	10;

		} else if($kaart == 12){

		$punten			=	10;

		} else if($kaart == 13){

		$punten			=	10;

		}

	$kaart				=	"{$soort}/{$kaart}";
	return Array($kaart,$punten);

	}

$dbres		=	mysql_query("SELECT * FROM `blackjack` WHERE `player`='{$data->login}'");
$aantal		=	mysql_num_rows($dbres);



	if($aantal != 0){

?>

<table align="center" width="600">
	<tr>
		<td class="subTitle">
		<b>Ultimatecrime - BlackJack <?php echo $data->land; ?></b>
		</td>
	</tr>
	<tr>
		<td class="mainTxt" width="600" align="center">

<?php

	$blackjack	=	mysql_fetch_object($dbres);

		if($blackjack->status == 0){

		list($plaatje1a,$waarde1a)			=	nieuweKaart();
		list($plaatje1b,$waarde1b)			=	nieuweKaart();
		list($plaatje2b,$waarde2b)			=	nieuweKaart();
		list($plaatje2a,$waarde2a)			=	nieuweKaart();
		$aas1						=	0;
		$aas2						=	0;

			if($waarde1a == "o"){

			$aas1					=	$aas1+1;

			} if($waarde1b == "o"){

			$aas1					=	$aas1+1;

			}


			if($waarde2a == "o"){

			$aas2					=	$aas2+1;

			} if($waarde2b == "o"){

			$aas2					=	$aas2+1;

			}

		$waarde1					=	$waarde1a+$waarde1b;
		$waarde2					=	$waarde2a+$waarde2b;

		mysql_query("UPDATE `blackjack` SET `status`='1' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `kaart1computer`='$plaatje1a' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `kaart2computer`='$plaatje1b' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `kaart1speler`='$plaatje2a' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `kaart2speler`='$plaatje2b' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `puntencomputer`='$waarde1' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `puntenspeler`='$waarde2' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `aas1`='$aas1' WHERE `id`='{$blackjack->id}'");
		mysql_query("UPDATE `blackjack` SET `aas2`='$aas2' WHERE `id`='{$blackjack->id}'");
		echo "De dealer heeft de kaarten gedeald.<meta http-equiv=\"refresh\" content=\"2\">";


?>

		</td>
	</tr>
	<tr>
		<td class="subtitle">&nbsp;</td>
	</tr>
</table>

<?php
		exit;
		} else if($blackjack->status == 1){

			if(isset($_POST['aas1'])){

			mysql_query("UPDATE `blackjack` SET `aas2`=`aas2`-'1',`puntenspeler`=`puntenspeler`+'1' WHERE `id`='{$_GET['id']}'");
			echo "Je hebt je aas 1 punt uitgereikt.<meta http-equiv=\"refresh\" content=\"2\">";
			exit;

			}


			if(isset($_POST['aas11'])){

			mysql_query("UPDATE `blackjack` SET `aas2`=`aas2`-'1',`puntenspeler`=`puntenspeler`+'11' WHERE `id`='{$_GET['id']}'");
			echo "Je hebt je aas 11 punten uitgereikt.<meta http-equiv=\"refresh\" content=\"2\">";
			exit;

			}


			if(isset($_POST['pasen'])){

				if($blackjack->puntenspeler > 22){

				mysql_query("UPDATE `blackjack` SET `status`='2' WHERE `id`='{$blackjack->id}'");


			$aas						=	$blackjack->aas1;
			$punten						=	0;

				if($aas == 2){

				$punten					=	12;

					if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

					list($soort1,$waarde1)	=	nieuweKaart();	
					mysql_query("UPDATE `blackjack` SET `kaart3computer`='$soort1' WHERE `id`='{$blackjack->id}'");

						if($waarde1 == "o"){

						$punten		=	$punten+1;

						} else {

						$punten		=	$punten+$waarde1;

						}


						if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

						list($soort2,$waarde2)	=	nieuweKaart();	
						mysql_query("UPDATE `blackjack` SET `kaart4computer`='$soort2' WHERE `id`='{$blackjack->id}'");

							if($waarde2 == "o"){

							$punten		=	$punten+1;

							} else {

							$punten		=	$punten+$waarde2;

							}


							if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

							list($soort3,$waarde3)	=	nieuweKaart();	
							mysql_query("UPDATE `blackjack` SET `kaart5computer`='$soort3' WHERE `id`='{$blackjack->id}'");

								if($waarde3 == "o"){

								$punten		=	$punten+1;

								} else {

								$punten		=	$punten+$waarde3;

								}


								if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

								list($soort4,$waarde4)	=	nieuweKaart();	
								mysql_query("UPDATE `blackjack` SET `kaart6computer`='$soort4' WHERE `id`='{$blackjack->id}'");

									if($waarde4 == "o"){

									$punten		=	$punten+1;

									} else {

									$punten		=	$punten+$waarde4;

									}

								}

							}

						}

					}

				mysql_query("UPDATE `blackjack` SET `puntencomputer`='$punten',`aas1`='0' WHERE `id`='{$blackjack->id}'");

				} else {

				mysql_query("UPDATE `blackjack` SET `status`='2' WHERE `id`='{$blackjack->id}'");

				$aas						=	$blackjack->aas1;

					if($aas == 2){
				        mysql_query("UPDATE `blackjack` SET `puntencomputer`=`puntencomputer`+'2',`aas1`='0' WHERE `id`='{$blackjack->id}'");
					} else if($aas == 1){
				        mysql_query("UPDATE `blackjack` SET `puntencomputer`=`puntencomputer`+'1',`aas1`='0' WHERE `id`='{$blackjack->id}'");
					}


				}

				} else if($aas == 1){

					if($blackjack->puntencomputer < 11){

					$punten				=	$blackjack->puntencomputer+11;

						if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

						list($soort1,$waarde1)	=	nieuweKaart();	
						mysql_query("UPDATE `blackjack` SET `kaart3computer`='$soort1' WHERE `id`='{$blackjack->id}'");

							if($waarde1 == "o"){

							$punten		=	$punten+1;
							} else {

							$punten		=	$punten+$waarde1;

							}

							if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

							list($soort2,$waarde2)	=	nieuweKaart();	
							mysql_query("UPDATE `blackjack` SET `kaart4computer`='$soort2' WHERE `id`='{$blackjack->id}'");

								if($waarde2 == "o"){

								$punten		=	$punten+1;

								} else {

								$punten		=	$punten+$waarde2;

								}


								if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

								list($soort3,$waarde3)	=	nieuweKaart();	
								mysql_query("UPDATE `blackjack` SET `kaart5computer`='$soort3' WHERE `id`='{$blackjack->id}'");

									if($waarde3 == "o"){

									$punten		=	$punten+1;

									} else {

									$punten		=	$punten+$waarde3;

									}


									if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

									list($soort4,$waarde4)	=	nieuweKaart();	
									mysql_query("UPDATE `blackjack` SET `kaart6computer`='$soort4' WHERE `id`='{$blackjack->id}'");

										if($waarde4 == "o"){

										$punten		=	$punten+1;

										} else {

										$punten		=	$punten+$waarde4;

										}

									}

								}

							}

						}

					} else {

					$punten				=	$blackjack->puntencomputer+1;

						if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

						list($soort1,$waarde1)	=	nieuweKaart();	
						mysql_query("UPDATE `blackjack` SET `kaart3computer`='$soort1' WHERE `id`='{$blackjack->id}'");

							if($waarde1 == "o"){

							$punten		=	$punten+1;

							} else {

							$punten		=	$punten+$waarde1;

							}


							if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

							list($soort2,$waarde2)	=	nieuweKaart();	
							mysql_query("UPDATE `blackjack` SET `kaart4computer`='$soort2' WHERE `id`='{$blackjack->id}'");

								if($waarde2 == "o"){

								$punten		=	$punten+1;

								} else {

								$punten		=	$punten+$waarde2;

								}


								if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

								list($soort3,$waarde3)	=	nieuweKaart();	
								mysql_query("UPDATE `blackjack` SET `kaart5computer`='$soort3' WHERE `id`='{$blackjack->id}'");

									if($waarde3 == "o"){

									$punten		=	$punten+1;

									} else {

									$punten		=	$punten+$waarde3;

									}


									if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten > 22 && $blackjack->puntenspeler > 22)){

									list($soort4,$waarde4)	=	nieuweKaart();	
									mysql_query("UPDATE `blackjack` SET `kaart6computer`='$soort4' WHERE `id`='{$blackjack->id}'");

										if($waarde4 == "o"){

										$punten		=	$punten+1;

										} else {

										$punten		=	$punten+$waarde4;

										}

									}

								}
							}

						}

					}

				mysql_query("UPDATE `blackjack` SET `puntencomputer`='$punten',`aas1`='0' WHERE `id`='{$blackjack->id}'");

				} else if($aas == 0){

				$punten						=	$blackjack->puntencomputer;

					if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

					list($soort1,$waarde1)	=	nieuweKaart();	
					mysql_query("UPDATE `blackjack` SET `kaart3computer`='$soort1' WHERE `id`='{$blackjack->id}'");

						if($waarde1 == "o"){

						$punten		=	$punten+1;
						} else {

						$punten		=	$punten+$waarde1;

						}


						if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

						list($soort2,$waarde2)	=	nieuweKaart();	
						mysql_query("UPDATE `blackjack` SET `kaart4computer`='$soort2' WHERE `id`='{$blackjack->id}'");

							if($waarde2 == "o"){

							$punten		=	$punten+1;

							} else {

							$punten		=	$punten+$waarde2;

							}


							if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

							list($soort3,$waarde3)	=	nieuweKaart();	
							mysql_query("UPDATE `blackjack` SET `kaart5computer`='$soort3' WHERE `id`='{$blackjack->id}'");

								if($waarde3 == "o"){

								$punten		=	$punten+1;

								} else {

								$punten		=	$punten+$waarde3;

								}


								if($punten < 16 OR ($blackjack->puntenspeler > $punten && $punten < 22 && $blackjack->puntenspeler < 22)){

								list($soort4,$waarde4)	=	nieuweKaart();	
								mysql_query("UPDATE `blackjack` SET `kaart6computer`='$soort4' WHERE `id`='{$blackjack->id}'");

									if($waarde4 == "o"){

									$punten		=	$punten+1;

									} else {

									$punten		=	$punten+$waarde4;

									}

								}

							}

						}

					}

				mysql_query("UPDATE `blackjack` SET `status`='2',`puntencomputer`='$punten',`aas1`='0' WHERE `id`='{$blackjack->id}'");

				}

			echo "Je hebt jou spel gestopt, nu is de computer aan de beurt.<meta http-equiv=\"refresh\" content=\"2\">";
?>

		</td>
	</tr>
	<tr>
		<td class="subtitle">&nbsp;</td>
	</tr>
</table>

<?php
			exit;

			}


			if(isset($_POST['nieuwekaart'])){

			list($plaatje,$waarde)			=	nieuweKaart();

				if($blackjack->kaart3speler == ""){

					if($waarde == "o"){

					mysql_query("UPDATE `blackjack` SET `aas2`=`aas2`+'1',`kaart3speler`='$plaatje' WHERE `id`='{$blackjack->id}'");

					} else {

					mysql_query("UPDATE `blackjack` SET `puntenspeler`=`puntenspeler`+'$waarde',`kaart3speler`='{$plaatje}' WHERE `id`='{$blackjack->id}'");

					}

				} else if($blackjack->kaart4speler == ""){

					if($waarde == "o"){

					mysql_query("UPDATE `blackjack` SET `aas2`=`aas2`+'1',`kaart4speler`='$plaatje' WHERE `id`='{$blackjack->id}'");

					} else {

					mysql_query("UPDATE `blackjack` SET `puntenspeler`=`puntenspeler`+'$waarde',`kaart4speler`='{$plaatje}' WHERE `id`='{$blackjack->id}'");

					}

				} else if($blackjack->kaart5speler == ""){

					if($waarde == "o"){

					mysql_query("UPDATE `blackjack` SET `aas2`=`aas2`+'1',`kaart5speler`='$plaatje' WHERE `id`='{$blackjack->id}'");

					} else {

					mysql_query("UPDATE `blackjack` SET `puntenspeler`=`puntenspeler`+'$waarde',`kaart5speler`='{$plaatje}' WHERE `id`='{$blackjack->id}'");

					}

				} else if($blackjack->kaart6speler == ""){

					if($waarde == "o"){

					mysql_query("UPDATE `blackjack` SET `aas2`=`aas2`+'1',`kaart6speler`='$plaatje' WHERE `id`='{$blackjack->id}'");

					} else {

					mysql_query("UPDATE `blackjack` SET `puntenspeler`=`puntenspeler`+'$waarde',`kaart6speler`='{$plaatje}' WHERE `id`='{$blackjack->id}'");

					}

				}


			echo "Je hebt een kaart getrokken en:<br /><br /><center><img src=\"images/$plaatje.jpg\" width=\"56\" height=\"80\" /></center><meta http-equiv=\"refresh\" content=\"1\">";
			exit;

			}


			if($blackjack->aas2 == 1){

			$move		=	"<form method=\"post\" action=\"gokken-blackjack.php?id={$blackjack->id}\">Hoeveel punten moet je aas hebben?<br /><input type=\"submit\" width=\"100\" name=\"aas1\" value=\"1 punt\" style=\"width:150\" /> <input type=\"submit\" name=\"aas11\" value=\"11 punten\" style=\"width:150\" /></form>";

			} else if($blackjack->speler1status == 1){

			$move		=	"";

			} else if($blackjack->puntenspeler >= 21){

			$move		=	"<form method=\"post\"><input type=\"submit\" name=\"pasen\" value=\"Passen\" style=\"width:150\" /></form>";

			} else {

			$move		=	"<form method=\"post\"><input type=\"submit\" name=\"nieuwekaart\" value=\"Nieuwe kaart\" style=\"width:150\" /> <input type=\"submit\" name=\"pasen\" value=\"Passen\" style=\"width:150\" /></form>";

			}

		echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"600\"><tr><td width=\"40%\"><br /><center>Speler: De bank<br>punten: (?)</td><td width=\"80%\">";
		echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/closed.gif\" width=\"56\" height=\"80\" /></td></tr></table>";
		echo "</td></tr></table>";
		echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"600\"><tr><td width=\"40%\" align=\"center\"><br />Speler: {$blackjack->player}<br />punten: ({$blackjack->puntenspeler})<br><br>$move</td><td>";

			if($blackjack->kaart6speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4speler}.jpg\" width=\"56 height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart5speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart6speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart5speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart5speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart4speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart3speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart2speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart1speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			}

		echo "</td></tr></table>";

		} else {

		$status1	=	"<font color=\"red\">Verloren</font>";
		$status2	=	"<font color=\"red\">Verloren</font>";

			if($blackjack->puntencomputer  <= 21){

			$punt1	=	$blackjack->puntencomputer;

			} else {

			$punt1	=	0;

			}


			if($blackjack->puntenspeler  <= 21){

			$punt2	=	$blackjack->puntenspeler;

			} else {

			$punt2	=	0;

			}


			if($punt2 > $punt1){

			$status2	=	"<font color=\"green\">Gewonnen</font>";
			mysql_query("UPDATE `gebruiker` SET `cash`=`cash`+'{$blackjack->inzet}'+'{$blackjack->inzet}' WHERE `login`='{$blackjack->player}'");

			}


			if($punt1 > $punt2){
			$status1	=	"<font color=\"green\">Gewonnen</font>";
			}

			if($punt1 == $punt2){

			mysql_query("UPDATE `gebruiker` SET `cash`=`cash`+'{$blackjack->inzet}' WHERE `login`='{$blackjack->player}'");
			$status2	=	"<font color=\"white\">gelijk</font>";
			$status1	=	"<font color=\"white\">gelijk</font>";

			}

		echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"600\"><tr><td width=\"40%\" align=\"center\"><br />Speler: De bank<br>punten: ({$blackjack->puntencomputer})<br /><br />$status1</td><td width=\"80%\">";

			if($blackjack->kaart6computer != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart5computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart6computer}.jpg\" width=\"56\"height=\"80\" border=1 bordercolor=black></td></tr></table>";

			} else if($blackjack->kaart5computer != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart5computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td></tr></table>";

			} else if($blackjack->kaart4computer != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td></tr></table>";

			} else if($blackjack->kaart3computer != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td></tr></table>";

			} else if($blackjack->kaart2computer != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td></tr></table>";

			} else if($blackjack->kaart1computer != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1computer}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td></tr></table>";

			}

		echo "</td></tr></table>";
		echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"600\"><tr><td width=\"40%\" align=\"center\"><br />Speler: {$blackjack->player}<br />punten: ({$blackjack->puntenspeler})<br /><br />$status2</td><td width=\"80%\">";

			if($blackjack->kaart6speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart5speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart6speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart5speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart5speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart4speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart4speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart3speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart3speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			} else if($blackjack->kaart2speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart2speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black></td></tr></table>";

			} else if($blackjack->kaart1speler != ""){

			echo "<table cellpadding=\"0\" cellspacing=\"1\"><tr><td width=\"56\" height=\"80\"><img src=\"images/{$blackjack->kaart1speler}.jpg\" width=\"56\" height=\"80\" border=1 bordercolor=black /></td></tr></table>";

			}

		echo "</td></tr></table>";
		mysql_query("DELETE FROM `blackjack` WHERE `id`='{$blackjack->id}'");

		}

?>

		</td>
	</tr>
	<tr>
		<td class="subtitle">&nbsp;</td>
	</tr>
</table>

<?php

	} else {

		if(isset($_POST['submit'])){

?>

<table align="center" width="600">
	<tr>
		<td class="subTitle">
		<b>Ultimatecrime - BlackJack <?php echo $data->land; ?></b>
		</td>
	</tr>
	<td class="mainTxt" width="600" align="center">

<?php

			if($_POST['geld'] < 0 || $_POST['geld'] == ""){

			echo "Voer een bedrag boven de €0,- in.<meta http-equiv=\"refresh\" content=\"2\">";

			} else if(! is_numeric($_POST['geld'])){

			echo "Het bedrag bestaat niet helemaal uit cijvers.<meta http-equiv=\"refresh\" content=\"2\">";

			} else if($_POST['geld'] > $data->cash){

			echo "Je hebt niet genoeg geld.<meta http-equiv=\"refresh\" content=\"2\">";

			} else {

			mysql_query("INSERT INTO `blackjack`(`player`,`inzet`) VALUES('{$data->login}','{$_POST['geld']}')");
			mysql_query("UPDATE `gebruiker` SET `cash`=`cash`-'{$_POST['geld']}' WHERE `login`='{$data->login}'");
			echo "Je hebt een nieuw spel gestart.<meta http-equiv=\"refresh\" content=\"1\">";

			}

?>

		</td>
	</tr>
	<tr>
		<td class="subtitle">&nbsp;</td>
	</tr>
</table>

<?php
		} else {	

?>

<form method="post">
<table align="center" width="600">
	<tr>
		<td class="subTitle" colspan="2">
		<b>Ultimatecrime - BlackJack <?php echo $data->land; ?></b>
		</td>
	</tr>
	<tr>
		<td width="200"><img src="images/ingame/blackjack_banner.jpg"></td>
		<td class="mainTxt" width="400" valign="top"><span class="tekstheader">BlackJack van de Grote Raad</a></span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="algemeen-help.php?item=faq&word=blackjack" target="content"><i>Speluitleg</i></a><br /><br /><strong>Minimale inzet: &euro; 0</strong><br /><strong>Maximale inzet: &euro; 99,999,999</strong></td>
	</tr>
	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="2" class="maintxt">
		<input type="hidden" name="spel" value="ja">
		<table width="560">
			<tr>
				<td width="20" valign="top"><img src="layout/images/icons/light_money.jpg" /></td>
				<td colspan="2"><span class="tekstheader">Inzet & spel starten</span></td>
			</tr>
			<tr>
				<td width="20" valign="top">&nbsp;</td>
				<td><input type="text" name="geld" maxlength="8" style="width:150" /></td>
				<td><input type="submit" name="submit" value="Start het spel!" style="width: 250;"></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="subtitle" colspan="2">&nbsp;</td>
	</tr>
</table>

<?php

		}
	}

?>

</body>
</html>