craeyon
|
Posted:
Tue Jul 04, 2006 4:50 pm |
|
ok this is my code. I paseted your code in this to. See what is wrong with this.
Code:
<?php
// filename: seating_chart.php
// ---------------------------------------------------------------------
// Nukelan Modules pack
// version 2.0
// by: Artemis
//
// artemis@nukelan.com
// http://www.nukelan.com
// =====================================================================
// Special thanks to:
// Contra - for integrating the Multipay and IPN option into Nukelan.
// you the man
// =====================================================================
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
if(!eregi("modules.php", $_SERVER['PHP_SELF'])){
die("You can't access this file directly...");
}
require_once("mainfile.php");
$ModName = basename( dirname( __FILE__ ) );
get_lang($ModName);
$moddir = "modules/$ModName/";
$index = $lanconfig['index'];
include ("header.php");
include ("includes/_universal.php");
global $uname, $uid;
$user = base64_decode($user);
$user = explode(":", $user);
$uid = "$user[0]";
$uname = "$user[1]";
$pwd = "$user[2]";
OpenTable();
$lan = mysql_fetch_array(mysql_query("SELECT * FROM nukelan_parties WHERE party_id='$pid'"));
echo "<center> :: <a href=\"modules.php?op=modload&name=$ModName&file=index&lanop=show_party&party_id=$lan[party_id]\">"._NLEVENTINFO."</a> :";
// if tournaments for this LAN
if (mysql_num_rows(mysql_query("SELECT * FROM nukelan_tournaments WHERE config_id='$lan[party_id]'"))) {
echo ": <a href=\"modules.php?op=modload&name=$ModName&file=tourneys&lanop=show_list&pid=$lan[party_id]\">"._NLTOURNAMENTS."</a> :";
}
// if Prizes for this LAN
if (mysql_num_rows(mysql_query("SELECT * FROM nukelan_prizes WHERE config_id='$lan[party_id]'"))) {
echo ": <a href=\"modules.php?op=modload&name=$ModName&file=prizes&lanop=show_prizes&party=$lan[party_id]\">"._NLPRIZES."</a> :";
}
// if lodgin for this LAN
if (mysql_num_rows(mysql_query("SELECT * FROM nukelan_lodging WHERE config_id='$lan[party_id]'"))) {
echo ": <a href=\"modules.php?op=modload&name=$ModName&file=lodging&lanop=show_lodges&pid=$lan[party_id]\">"._NLLODGING."</a> :";
}
// if Seating Chart for this LAN
if ($lan['schart'] > 0) {
echo ": <a href=\"modules.php?op=modload&name=$ModName&file=seating_chart&seat=showChart&pid=$lan[party_id]\">"._NLSEATINGCHART."</a> :";
}
// if LAN has sponsors
if (mysql_num_rows(mysql_query("SELECT * FROM nukelan_sponsors_parties WHERE party_id='$lan[party_id]'"))) {
echo ": <a href=\"modules.php?op=modload&name=$ModName&file=sponsors&pid=$lan[party_id]\">"._NLPARTYSPONSORS."</a> :";
}
echo ": <a href=\"modules.php?op=modload&name=$ModName&file=profile&pid=$lan[party_id]\">"._NLPROFILE."</a> ::</center>";
CloseTable();
echo "<br>";
OpenTable();
function object_exists($tableID) {
if(@mysql_num_rows(@mysql_query("SELECT * FROM nukelan_seat_objects WHERE id=" . $tableID))) return 1;
else return 0;
}
$row = @mysql_fetch_array(@mysql_query("SELECT * FROM nukelan_signedup WHERE lan_uid='" . $_COOKIE["userid"] . "' AND lan_id='$pid'"));
$party = @mysql_fetch_array(@mysql_query("SELECT * FROM nukelan_parties WHERE party_id='$pid'"));
$roomid = "$party[schart]";
function showseats($pid,$row,$party,$roomid) {
global $uid, $ModName;
$colors["background"] = "#000000";
$colors["primary"] = "#00ff00";
$colors["secondary"] = "#009900";
$colors["border"] = "#00ff00";
$colors["cell_title"] = "#111111";
$colors["cell_background"] = "#000000";
$colors["cell_alternate"] = "#000000";
$colors["text"] = "#ffffff";
$colors["blended_text"] = "#444444";
$colors["graphs"] = $colors["primary"];
$colors["cell_background"] = "#000000";
$colors["cell_alternate"] = "#000000";
$colors["text"] = "#ffffff";
$colors["blended_text"] = "#444444";
$colors["graphs"] = $colors["primary"];
$uresult = mysql_query("SELECT * FROM nukelan_signedup WHERE lan_uid='$uid' AND lan_id='$pid'");
$urow = mysql_fetch_array($uresult);
$tresult = mysql_query("SELECT * FROM nukelan_seat_objects WHERE id='$urow[room_loc]' AND room_id='$roomid'");
$useat = mysql_fetch_array($tresult);
if(@mysql_num_rows(@mysql_query("SELECT * FROM nukelan_seat_rooms WHERE id='$roomid'"))) {
echo "<b>"._NLCLICKBELOW." "._NLPUTMOUSE."</b><br>";
if ($useat) echo "<b>"._NLHAVESEAT." <font size=2 color=green>$useat[name]</font></b><br>";
else echo "<b>"._NLNOSEATRESERVED."</b><br>";
?>
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td align="center" colspan="2" bgcolor="<?=$colors["cell_title"]?>"><?php
//if($_POST["act"] != "admindeleteallrooms") { ?>
<img src="modules/<? echo "$ModName"; ?>/seating_image.php?c=<?php print ($_GET["c"] ? $_GET["c"] : "0") ?>&grid=<?php print ($_GET["grid"] == 1 ? "1" : "0") ?>&roomid=<?php print "$roomid" ?>" name="seat"<?php if(current_security_level()>=2) { ?> onClick="clicky((window.event.x - findPosX(document.seat)) / 5, (window.event.y - findPosY(document.seat)) / 5)" onMouseOver="coords((window.event.x - findPosX(document.seat)) / 5, (window.event.y - findPosY(document.seat)) / 5)"<?php } ?> usemap="#seatmap" border="0" ismap GALLERYIMG="no">
<?php require_once("modules/$ModName/seating_map.php");
//} ?>
</td></tr><?
//if($_POST["act"] != "admindeleteallrooms"&¤t_security_level()==1) { ?>
<?php echo "<tr><td><br><b>"._NLCLICKABOVE." "._NLPUTMOUSE."</b><br><br></td></tr>";
//}
$numUsersHere = @mysql_result(mysql_query("SELECT COUNT(*) FROM nukelan_signedup WHERE lan_id='$pid' AND room_loc=" . $thisobj["id"]), 0); ?>
<tr><td align="left" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan="2" bgcolor="<?=$colors["cell_title"]?>"> <font color="<?=$colors["primary"]?>"><b>current table: <?php print $thisobj['name'] ?></b></font></td></tr>
<tr>
<td valign="top" align="left" width="50%">
<table border="0" cellpadding="0" cellspacing="0"><?php
if($thisobj["type"] == "table") { ?>
<tr><td><b> users here:</b> <?php print $numUsersHere ?>/<?php print $thisobj["capacity"] ?></td></tr>
<tr><td><?php
if($numUsersHere > 0) {
//$usersHere = mysql_query("SELECT * FROM nukelan_signedup WHERE lan_id='$pid' AND room_loc=" . $thisobj["id"]);
$usersHere = mysql_query("SELECT l.*, u.* FROM nuke_users AS l LEFT JOIN nukelan_signedup AS u ON (l.user_id=u.lan_uid) WHERE u.lan_id='$pid' AND room_loc=" . $thisobj["id"] . " ORDER BY l.username");
while($userHere = mysql_fetch_array($usersHere)) {
?> <?php print $userHere["username"] ?><br><?php
}
}
else {
echo " "._NLSMALLNONE."";
} ?></td></tr><?php
} else {
echo "<tr><td> "._NLNOTATABLE."</td></tr>";
} ?>
</table>
</td>
<td width="50%" valign="middle">
<?php
if ($party[active]) {
echo "<font color=red><b>"._NLSORRYSHUTDOWN."</b></font>";
} else {
ShowButtons($pid,$thisobj);
}
?>
</td>
</tr>
</table>
</td></tr>
<?php
} // end if(get[c])
} else {
echo ""._NLSORRYNOCHART."";
}
}
function ShowButtons($pid,$thisobj){
global $user, $uid, $ModName;
$sitting = mysql_num_rows(mysql_query("SELECT * FROM nukelan_signedup WHERE lan_uid='$uid' AND lan_id='$pid' AND room_loc >= '1'"));
echo " <table border=0>\n"
." <tr>\n";
if ($thisobj >= 1)
echo "<td>\n"
." <form action=\"modules.php\" method=\"post\" style=\"margin: 0;\">\n"
." <input type=hidden name=op value=modload>\n"
." <input type=hidden name=name value=$ModName>\n"
." <input type=hidden name=file value=seating_chart>\n"
." <input type=hidden name=lanop value=userSit>\n"
." <input type=hidden name=uid value=".$uid.">\n"
." <input type=hidden name=rloc value=".$thisobj['id'].">\n"
." <input type=hidden name=pid value='$pid'>\n"
." <input type=submit value=\""._NLSITDOWNHERE."\" style=\"width: 120px;\">\n"
." </form>\n"
." </td>\n";
if ($sitting==1)
echo "<td>\n"
."<form action=\"modules.php\" method=\"post\" style=\"margin: 0;\">\n"
." <input type=hidden name=op value=modload>\n"
." <input type=hidden name=name value=$ModName>\n"
." <input type=hidden name=file value=seating_chart>\n"
." <input type=hidden name=lanop value=userStand>\n"
." <input type=hidden name=uid value=".$uid.">\n"
." <input type=hidden name=pid value='$pid'>\n"
." <input type=submit value=\""._NLSTANDUP."\" style=\"width: 120px;\">\n"
." </form>\n"
." </td>\n";
echo "</tr></table>\n";
}
function sitting($pid,$uid,$rloc,$action) {
if ($uid <= 1) die (""._NLREGISTERFORSEAT."");
$result = mysql_query("SELECT * FROM nukelan_seat_objects WHERE id='$rloc'");
$row = mysql_fetch_array($result);
$num_here = mysql_num_rows(mysql_query("SELECT * FROM nukelan_signedup WHERE lan_id='$pid' AND room_loc='$rloc'"));
switch ($action) {
case 'stand':
if (!mysql_query("UPDATE nukelan_signedup SET room_loc=NULL WHERE lan_uid='$uid' AND lan_id='$pid'")) echo "font size=2 color=red><b>"._NLCANNOTSTANDUP."</b></font>";
//else echo"<h2>You do not have a reserved seat</h2>";
break;
default:
if ($num_here >= $row['capacity']) echo "<font size=2 color=red><b>"._NLTABLEFULL."</b></font>";
elseif (!mysql_query("UPDATE nukelan_signedup SET room_loc='$rloc' WHERE lan_uid='$uid' AND lan_id='$pid'")) echo "<font size=2 color=red><b>"._NLCANNOTSITHERE."</b></font>";
//else echo "<h2>You have reserved a seat at table: $row[name]</h2>";
break;
}
}
switch ($lanop) {
case 'userSit':
sitting($pid,$uid,$rloc, '');
mysql_query("DELETE FROM nukelan_map_temp WHERE uid='$uid'");
mysql_query("INSERT INTO nukelan_map_temp SET uid='$uid', room_id='$roomid'");
showseats($pid,$row,$party,$roomid);
break;
case 'userStand':
sitting($pid,$uid,$rloc,'stand');
mysql_query("DELETE FROM nukelan_map_temp WHERE uid='$uid'");
mysql_query("INSERT INTO nukelan_map_temp SET uid='$uid', room_id='$roomid'");
showseats($pid,$row,$party,$roomid);
break;
case 'showChart':
mysql_query("DELETE FROM nukelan_map_temp WHERE uid='$uid'");
mysql_query("INSERT INTO nukelan_map_temp SET uid='$uid', room_id='$roomid'");
showseats($pid,$row,$party,$roomid);
break;
default:
mysql_query("DELETE FROM nukelan_map_temp WHERE uid='$uid'");
mysql_query("INSERT INTO nukelan_map_temp SET uid='$uid', room_id='$roomid'");
showseats($pid,$row,$party,$roomid);
break;
}
echo "</table>";
CloseTable();
include ("footer.php");
?>
|
this is the error that i get
Parse error: parse error, unexpected T_ELSE in /home/****/public_html/modules/Nukelan/seating_chart.php on line 167 |
|
|
gregexp
|
Posted:
Wed Jul 05, 2006 9:28 am |
|
time to debug the script then.
After looking at the code, This was not ported to nuke the way (inmy opinion) It should be. The code creates its own mysql link, includes are set to the wrong file link, Those are in my first 5 minutes of looking at this:
this is what it was:Code:require_once("../../config.php");
$link = mysql_connect($dbhost, $dbuname, $dbpass)
or die("Could not connect : " . mysql_error());
// print "Connected successfully";
mysql_select_db($dbname) or die("Could not select database");
$page = getenv ("HTTP_HOST");
@require_once("http://$page/include/_functions.php");
function scale($value, $dim = 5) { return $value * $dim; }
function grabcolors($hexval) {
$hex = substr($hexval, 1);
$ret["r"] = hexdec(substr($hex, 0, 2));
$ret["g"] = hexdec(substr($hex, 2, 2));
$ret["b"] = hexdec(substr($hex, 4, 2));
return $ret;
}
$roomid = $_SERVER['QUERY_STRING'];
$roomidloc = strpos("".$_SERVER['QUERY_STRING']."", 'roomid=');
$roomid = substr("".$_SERVER['QUERY_STRING']."", $roomidloc+7);
$ModName = basename( dirname( __FILE__ ) );
//$room = @mysql_fetch_array(@mysql_query("SELECT * FROM nukelan_seat_rooms WHERE id='$roomid'"));
$roomresult = mysql_query("SELECT width,height FROM nukelan_seat_rooms WHERE id='$roomid'");
$room["width"] = mysql_result($roomresult,0,"width");
//print mysql_result($roomresult,0,"width");
$room["height"] = mysql_result($roomresult,0,"height");
//print mysql_result($roomresult,0,"height");
mysql_free_result($roomresult);
$objects = @mysql_query("SELECT * FROM nukelan_seat_objects WHERE id > '0' AND room_id='$roomid'");
$img = imagecreate($room["width"] * 5, $room["height"] * 5)
or die("cannot initialize new GD image stream.<br>administrator: please verify that the GD library is included in your PHP build.");
$seat["background"] = "#000000";
$seat["border"] = "#FFFFFF";
$seat["tablecolor"] = "#009900";
$seat["tableborder"] = "#00ff00";
$seat["voidcolor"] = "#000000";
$seat["voidborder"] = "#ffffff";
$seat["gridcolor"] = "#CCCCCC";
$seat["gridmidcolor"] = "#0000FF";
$seat["gridlitecolor"] = "#FFFFFF";
$seat["currentcolor"] = "#00ff00";
$c = grabcolors($seat["tablecolor"]);
$color["tablecolor"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["tableborder"]);
$color["tableborder"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["voidcolor"]);
$color["voidcolor"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["voidborder"]);
$color["voidborder"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["gridcolor"]);
$color["grid"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["gridmidcolor"]);
$color["gridmid"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["gridlitecolor"]);
$color["gridlite"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["currentcolor"]);
$color["current"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["background"]);
$color["bg"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["border"]);
$color["border"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
imagefill($img, 0, 0, $color["bg"]);
imagerectangle($img, 0, 0, scale($room["width"]) - 1, scale($room["height"]) - 1, $color["border"]);
while($thisobj = @mysql_fetch_array($objects)) {
imagefilledrectangle($img, scale($thisobj["startx"]), scale($thisobj["starty"]), scale($thisobj["startx"] + $thisobj["width"]), scale($thisobj["starty"] + $thisobj["height"]), ($_GET["c"] == $thisobj["id"] ? $color["tablecolor"] : ($thisobj["type"] == "table" ? $color["tablecolor"] : $color["tablecolor"])));
imagerectangle($img, scale($thisobj["startx"]), scale($thisobj["starty"]), scale($thisobj["startx"] + $thisobj["width"]), scale($thisobj["starty"] + $thisobj["height"]), ($thisobj["type"] == "table" ? $color["tableborder"] : $color["tableborder"]));
}
if($_GET["grid"] == 1) {
for($i = 0; $i < $room["width"]; $i++) {
if($i % 10 == 0) imageline($img, scale($i), 0, scale($i), scale($room["height"]), $color["gridlite"]);
elseif($i % 5 == 0) imageline($img, scale($i), 0, scale($i), scale($room["height"]), $color["gridmid"]);
else imageline($img, scale($i), 0, scale($i), scale($room["height"]), $color["grid"]);
}
for($i = 0; $i < $room["height"]; $i++) {
if($i % 10 == 0) imageline($img, 0, scale($i), scale($room["width"]), scale($i), $color["gridlite"]);
elseif($i % 5 == 0) imageline($img, 0, scale($i), scale($room["width"]), scale($i), $color["gridmid"]);
else imageline($img, 0, scale($i), scale($room["width"]), scale($i), $color["grid"]);
}
}
if (imagetypes() & IMG_GIF) {
header ("Content-type: image/gif");
imagegif ($img);
}
elseif(imagetypes() & IMG_PNG) {
header("Content-type: image/png");
imagepng($img);
}
elseif (imagetypes() & IMG_JPG) {
header("Content-type: image/jpeg");
imagejpeg($img, "", 100);
}
elseif(imagetypes() & IMG_WBMP) {
header("Content-type: image/vnd.wap.wbmp");
imagebmp($img);
}
else die("No image support in this PHP server");
//imagepng($img); // change to gif !
//imagedestroy($img);
?>
|
Now Ive change that to :
Code:<?php
// filename: seating_image.php
// ---------------------------------------------------------------------
// Nukelan Modules pack
// version 2.0
// by: Artemis
//
// artemis@nukelan.com
// http://www.nukelan.com
// =====================================================================
// Special thanks to:
// Contra - for integrating the Multipay and IPN option into Nukelan.
// you the man
// =====================================================================
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
include("header.php");
$page = getenv ("HTTP_HOST");
@require_once("/modules/$module_name/includes/_functions.php");
function scale($value, $dim = 5) { return $value * $dim; }
function grabcolors($hexval) {
$hex = substr($hexval, 1);
$ret["r"] = hexdec(substr($hex, 0, 2));
$ret["g"] = hexdec(substr($hex, 2, 2));
$ret["b"] = hexdec(substr($hex, 4, 2));
return $ret;
}
$roomid = $_SERVER['QUERY_STRING'];
$roomidloc = strpos("".$_SERVER['QUERY_STRING']."", 'roomid=');
$roomid = substr("".$_SERVER['QUERY_STRING']."", $roomidloc+7);
$ModName = basename( dirname( __FILE__ ) );
//$room = @mysql_fetch_array(@mysql_query("SELECT * FROM nukelan_seat_rooms WHERE id='$roomid'"));
$roomresult = mysql_query("SELECT width,height FROM nukelan_seat_rooms WHERE id='$roomid'");
$room["width"] = mysql_result($roomresult,0,"width");
//print mysql_result($roomresult,0,"width");
$room["height"] = mysql_result($roomresult,0,"height");
//print mysql_result($roomresult,0,"height");
mysql_free_result($roomresult);
$objects = @mysql_query("SELECT * FROM nukelan_seat_objects WHERE id > '0' AND room_id='$roomid'");
$img = imagecreate($room["width"] * 5, $room["height"] * 5)
or die("cannot initialize new GD image stream.<br>administrator: please verify that the GD library is included in your PHP build.");
$seat["background"] = "#000000";
$seat["border"] = "#FFFFFF";
$seat["tablecolor"] = "#009900";
$seat["tableborder"] = "#00ff00";
$seat["voidcolor"] = "#000000";
$seat["voidborder"] = "#ffffff";
$seat["gridcolor"] = "#CCCCCC";
$seat["gridmidcolor"] = "#0000FF";
$seat["gridlitecolor"] = "#FFFFFF";
$seat["currentcolor"] = "#00ff00";
$c = grabcolors($seat["tablecolor"]);
$color["tablecolor"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["tableborder"]);
$color["tableborder"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["voidcolor"]);
$color["voidcolor"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["voidborder"]);
$color["voidborder"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["gridcolor"]);
$color["grid"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["gridmidcolor"]);
$color["gridmid"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["gridlitecolor"]);
$color["gridlite"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["currentcolor"]);
$color["current"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["background"]);
$color["bg"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
$c = grabcolors($seat["border"]);
$color["border"] = imagecolorallocate($img, $c["r"], $c["g"], $c["b"]);
imagefill($img, 0, 0, $color["bg"]);
imagerectangle($img, 0, 0, scale($room["width"]) - 1, scale($room["height"]) - 1, $color["border"]);
while($thisobj = @mysql_fetch_array($objects)) {
imagefilledrectangle($img, scale($thisobj["startx"]), scale($thisobj["starty"]), scale($thisobj["startx"] + $thisobj["width"]), scale($thisobj["starty"] + $thisobj["height"]), ($_GET["c"] == $thisobj["id"] ? $color["tablecolor"] : ($thisobj["type"] == "table" ? $color["tablecolor"] : $color["tablecolor"])));
imagerectangle($img, scale($thisobj["startx"]), scale($thisobj["starty"]), scale($thisobj["startx"] + $thisobj["width"]), scale($thisobj["starty"] + $thisobj["height"]), ($thisobj["type"] == "table" ? $color["tableborder"] : $color["tableborder"]));
}
if($_GET["grid"] == 1) {
for($i = 0; $i < $room["width"]; $i++) {
if($i % 10 == 0) imageline($img, scale($i), 0, scale($i), scale($room["height"]), $color["gridlite"]);
elseif($i % 5 == 0) imageline($img, scale($i), 0, scale($i), scale($room["height"]), $color["gridmid"]);
else imageline($img, scale($i), 0, scale($i), scale($room["height"]), $color["grid"]);
}
for($i = 0; $i < $room["height"]; $i++) {
if($i % 10 == 0) imageline($img, 0, scale($i), scale($room["width"]), scale($i), $color["gridlite"]);
elseif($i % 5 == 0) imageline($img, 0, scale($i), scale($room["width"]), scale($i), $color["gridmid"]);
else imageline($img, 0, scale($i), scale($room["width"]), scale($i), $color["grid"]);
}
}
if (imagetypes() & IMG_GIF) {
header ("Content-type: image/gif");
imagegif ($img);
}
elseif(imagetypes() & IMG_PNG) {
header("Content-type: image/png");
imagepng($img);
}
elseif (imagetypes() & IMG_JPG) {
header("Content-type: image/jpeg");
imagejpeg($img, "", 100);
}
elseif(imagetypes() & IMG_WBMP) {
header("Content-type: image/vnd.wap.wbmp");
imagebmp($img);
}
else die("No image support in this PHP server");
//imagepng($img); // change to gif !
//imagedestroy($img);
?>
|
|
|
|