31. december 2003 - 16:11
#6
<?
$connection = mysql_connect("minip","login","kode");
mysql_select_db("mindb", $connection);
$im = ImageCreateFromGif("$DOCUMENT_ROOT/images/pladsres_m_lobby_66_pladser.gif");
$yellow = ImageColorAllocate($im,255,255,0);
$orange = ImageColorAllocate($im,255,144,0);
$result_2 = mysql_query("SELECT PladsRes FROM users WHERE ID = $user_id");
$row = mysql_fetch_array($result_2);
$seat = $row["PladsRes"];
$plads = array(
1 => array("x" => 7, "y" => 33),
2 => array("x" => 22, "y" => 38),
3 => array("x" => 7, "y" => 44),
4 => array("x" => 22, "y" => 49),
5 => array("x" => 7, "y" => 55),
6 => array("x" => 22, "y" => 60),
7 => array("x" => 7, "y" => 66),
8 => array("x" => 22, "y" => 71),
9 => array("x" => 7, "y" => 77),
10 => array("x" => 22, "y" => 82),
11 => array("x" => 7, "y" => 88),
12 => array("x" => 22, "y" => 93),
13 => array("x" => 7, "y" => 98),
14 => array("x" => 22, "y" => 104),
15 => array("x" => 7, "y" => 109),
16 => array("x" => 22, "y" => 115),
17 => array("x" => 7, "y" => 120),
18 => array("x" => 22, "y" => 126)
);
$plads_lobby = array(
1 => array("x" => 10, "y" => 156),
2 => array("x" => 32, "y" => 156),
3 => array("x" => 10, "y" => 164),
4 => array("x" => 32, "y" => 164),
5 => array("x" => 10, "y" => 171),
6 => array("x" => 32, "y" => 171),
7 => array("x" => 10, "y" => 179),
8 => array("x" => 32, "y" => 179),
9 => array("x" => 10, "y" => 187),
10 => array("x" => 32, "y" => 187),
11 => array("x" => 10, "y" => 195),
12 => array("x" => 32, "y" => 195),
);
for ($raekke = 1; $raekke <= 17; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads[$raekke]["x"], $plads[$raekke]["y"], $plads[$raekke]["x"]+4, $plads[$raekke]["y"]+3, $color);
}
}
for ($raekke = 2; $raekke <= 18 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads[$raekke]["x"], $plads[$raekke]["y"], $plads[$raekke]["x"]+4, $plads[$raekke]["y"]+3, $color);
}
}
for ($raekke = 19; $raekke <= 35 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads[$raekke-18]["x"]+37, $plads[$raekke-18]["y"], $plads[$raekke-18]["x"]+41, $plads[$raekke-18]["y"]+3, $color);
}
}
for ($raekke = 20; $raekke <= 36 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads[$raekke-18]["x"]+37, $plads[$raekke-18]["y"], $plads[$raekke-18]["x"]+41, $plads[$raekke-18]["y"]+3, $color);
}
}
for ($raekke = 37; $raekke <= 53 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads[$raekke-36]["x"]+75, $plads[$raekke-36]["y"], $plads[$raekke-36]["x"]+79, $plads[$raekke-36]["y"]+3, $color);
}
}
for ($raekke = 38; $raekke <= 54 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads[$raekke-36]["x"]+74, $plads[$raekke-36]["y"], $plads[$raekke-36]["x"]+78, $plads[$raekke-36]["y"]+3, $color);
}
}
for ($raekke = 55; $raekke <= 65 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads_lobby[$raekke-54]["x"], $plads_lobby[$raekke-54]["y"], $plads_lobby[$raekke-54]["x"]+4, $plads_lobby[$raekke-54]["y"]+3, $color);
}
}
for ($raekke = 56; $raekke <= 66 ; $raekke += 2){
$result_2 = mysql_query("SELECT * FROM users WHERE PladsRes = '$raekke'");
if (mysql_num_rows($result_2) > 0){
$color = $raekke != $seat ? $yellow : $orange;
imagefilledrectangle($im, $plads_lobby[$raekke-54]["x"], $plads_lobby[$raekke-54]["y"], $plads_lobby[$raekke-54]["x"]+4, $plads_lobby[$raekke-54]["y"]+3, $color);
}
}
header("Content-type: image/gif");
ImageGIF($im);
?>