Bueno aqi esta el code recirtado en 2 partes por que no cabe xD espero que me puedan ayudar
Código PHP:
<script language="javascript">
function casilla(numero, cons, lvl) {
if(cons == 0) {
cons = "N/A";
}else if (cons == 1){
cons = "Casa";
}else if(cons == 2) {
cons = "Casa";
}else if(cons == 3) {
cons = "Laboratorio";
}else if(cons == 4) {
cons = "Laboratorio";
}else if(cons == 5) {
cons = "Embajada";
}else if(cons == 6) {
cons = "Embajada";
}else if(cons == 7) {
cons = "Bosque";
}else if(cons == 8) {
cons = "Bosque";
}
if(lvl == 0) {
lvl = "N/A";
}
if(numero == 0) {
document.getElementById('campo').innerHTML = " ";
document.getElementById('cons').innerHTML = " ";
document.getElementById('lvl').innerHTML = " ";
}else{
document.getElementById('campo').innerHTML = numero;
document.getElementById('cons').innerHTML = cons;
document.getElementById('lvl').innerHTML = lvl;
}
}
function ventana(casilla) {
window.opener.loadurl('construir.php?id_construir='+casilla+'', 'main');
window.close()
}
function ventana2(casilla2) {
window.opener.loadurl('construir.php?id_construir='+casilla2+'', 'main');
window.close()
}
</script>
<link href="css.css" rel="stylesheet" type="text/css">
<?
include("conectar.php");
include("funciones.php");
if(isset($_GET['id_mapa'])) {
$id_mapa = $_GET['id_mapa'];
}else{
$id_mapa = 1;
}
$sql_campo = "SELECT * FROM usuarios WHERE user='$user'";
$result_campo = mysql_query($sql_campo, $conectar) or die (mysql_error());
$row_campo = mysql_fetch_array($result_campo);
$max_campo = $row_campo['casillas'];
$max_campo2 = $max_campo - 24;
if($id_mapa >= 476) {
$id_mapa = 476;
}
if($id_mapa <= 0) {
$id_mapa = 1;
}
$casilla1 = $id_mapa;
$casilla2 = $id_mapa + 1;
$casilla3 = $id_mapa + 2;
$casilla4 = $id_mapa + 3;
$casilla5 = $id_mapa + 4;
$casilla6 = $casilla1 + 5;
$casilla7 = $casilla2 + 5;
$casilla8 = $casilla3 + 5;
$casilla9 = $casilla4 + 5;
$casilla10 = $casilla5 + 5;
$casilla11 = $casilla6 + 5;
$casilla12 = $casilla7 + 5;
$casilla13 = $casilla8 + 5;
$casilla14 = $casilla9 + 5;
$casilla15 = $casilla10 + 5;
$casilla16 = $casilla11 + 5;
$casilla17 = $casilla12 + 5;
$casilla18 = $casilla13 + 5;
$casilla19 = $casilla14 + 5;
$casilla20 = $casilla15 + 5;
$casilla21 = $casilla16 + 5;
$casilla22 = $casilla17 + 5;
$casilla23 = $casilla18 + 5;
$casilla24 = $casilla19 + 5;
$casilla25 = $casilla20 + 5;
$mapa_flecha4 = $id_mapa + 1;
$mapa_flecha = $id_mapa + 5;
if($id_mapa == 1) {
$mapa_flecha3 = 1;
}else{
$mapa_flecha3 = $id_mapa - 1;
}
if($id_mapa <= 5 ) {
$mapa_flecha2 = 1;
}else{
$mapa_flecha2 = $id_mapa - 5;
}
if($mapa_flecha >= $max_campo2) {
$mapa_flecha = $max_campo2;
}
if($id_mapa >= $max_campo2) {
$mapa_flecha4 = $max_campo2;
}
$num = 1;
$num3 = $id_mapa;
do{
//casilla .num
${"sql_casilla_".$num} = "SELECT * FROM construccion WHERE id='".$num3."' and user='".$user."'";
${"result_casilla_".$num} = mysql_query(${"sql_casilla_".$num}) or die (mysql_error());
if(${"row_casilla_".$num} = mysql_fetch_array(${"result_casilla_".$num})) {
${"lvl".$num} = ${"row_casilla_".$num}['lvl'];
${"construir".$num} = ${"row_casilla_".$num}['construccion'];
}else{
${"lvl".$num} = "0";
${"construir".$num} = "0";
}
$num++;
$num3++;
}while($num <= 25);
?>
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
left:9px;
top:56px;
width:428px;
height:185px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:9px;
top:0px;
width:117px;
height:50px;
z-index:2;
}
#apDiv3 {
position:absolute;
width:21px;
height:29px;
z-index:3;
left: 36px;
top: 111px;
}
#apDiv4 {
position:absolute;
width:32px;
height:24px;
z-index:4;
left: 344px;
top: 80px;
}
#apDiv5 {
position:absolute;
width:32px;
height:24px;
z-index:4;
left: 67px;
top: 185px;
}
#apDiv6 {
position:absolute;
width:25px;
height:26px;
z-index:5;
left: 92px;
top: 64px;
}
#apDiv7 {
position:absolute;
width:26px;
height:28px;
z-index:6;
left: 325px;
top: 201px;
}
#apDiv9 {
position:absolute;
width:27px;
height:28px;
z-index:7;
left: 74px;
top: 134px;
}
#apDiv8 {
position:absolute;
left:96px;
top:3px;
width:401px;
height:23px;
z-index:8;
}
.Estilo3 {
color: #FFFFFF;
font-size: 16px;
}
.casilla {
color: #FFFFFF;
}
#apDiv10 {
position:absolute;
left:116px;
top:155px;
width:24px;
height:27px;
z-index:9;
}
#apDiv13 {
position:absolute;
left:84px;
top:96px;
width:24px;
height:27px;
z-index:9;
}
#apDiv11 {
position:absolute;
left:156px;
top:174px;
width:24px;
height:27px;
z-index:9;
}
#apDiv12 {
position:absolute;
left:198px;
top:195px;
width:24px;
height:27px;
z-index:9;
}
#apDiv14 {
position:absolute;
left:122px;
top:120px;
width:24px;
height:27px;
z-index:9;
}
#apDiv15 {
position:absolute;
left:166px;
top:140px;
width:24px;
height:27px;
z-index:9;
}
#apDiv16 {
position:absolute;
left:208px;
top:161px;
width:24px;
height:27px;
z-index:9;
}
#apDiv17 {
position:absolute;
left:245px;
top:181px;
width:24px;
height:27px;
z-index:9;
}
#apDiv18 {
position:absolute;
left:128px;
top:82px;
width:24px;
height:27px;
z-index:9;
}
#apDiv19 {
position:absolute;
left:168px;
top:102px;
width:24px;
height:27px;
z-index:9;
}
#apDiv20 {
position:absolute;
left:211px;
top:123px;
width:24px;
height:27px;
z-index:9;
}
#apDiv21 {
position:absolute;
left:252px;
top:144px;
width:24px;
height:27px;
z-index:9;
}
#apDiv22 {
position:absolute;
left:289px;
top:166px;
width:24px;
height:27px;
z-index:9;
}
#apDiv23 {
position:absolute;
left:174px;
top:65px;
width:24px;
height:27px;
z-index:9;
}
#apDiv24 {
position:absolute;
left:215px;
top:86px;
width:24px;
height:27px;
z-index:9;
}
#apDiv25 {
position:absolute;
left:257px;
top:106px;
width:24px;
height:27px;
z-index:9;
}
#apDiv26 {
position:absolute;
left:297px;
top:128px;
width:24px;
height:27px;
z-index:9;
}
#apDiv27 {
position:absolute;
left:335px;
top:150px;
width:24px;
height:27px;
z-index:9;
}
#apDiv28 {
position:absolute;
left:221px;
top:50px;
width:24px;
height:27px;
z-index:9;
}
#apDiv29 {
position:absolute;
left:260px;
top:70px;
width:24px;
height:27px;
z-index:9;
}
#apDiv30 {
position:absolute;
left:302px;
top:91px;
width:24px;
height:27px;
z-index:9;
}
#apDiv31 {
position:absolute;
left:342px;
top:112px;
width:24px;
height:27px;
z-index:9;
}
#apDiv32 {
position:absolute;
left:380px;
top:134px;
width:24px;
height:27px;
z-index:9;
}
#apDiv33 { position:absolute;
left:116px;
top:155px;
width:24px;
height:27px;
z-index:9;
}
#apDiv34 { position:absolute;
left:116px;
top:155px;
width:24px;
height:27px;
z-index:9;
}
#apDiv35 { position:absolute;
left:116px;
top:155px;
width:24px;
height:27px;
z-index:9;
}
#apDiv36 {
position:absolute;
left:728px;
top:227px;
width:35px;
height:41px;
z-index:9;
}
#apDiv37 {
position:absolute;
left:571px;
top:152px;
width:69px;
height:57px;
z-index:9;
}
#apDiv38 {
position:absolute;
left:397px;
top:83px;
width:34px;
height:16px;
z-index:9;
}
#apDiv39 {
position:absolute;
left:469px;
top:236px;
width:35px;
height:57px;
z-index:10;
}
body {
background-color: #000000;
}
#apDiv41 { position:absolute;
width:18px;
height:39px;
z-index:3;
left: 38px;
top: 100px;
}
#apDiv42 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 81px;
top: 123px;
}
#apDiv43 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 121px;
top: 143px;
}
#apDiv44 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 161px;
top: 163px;
}
#apDiv45 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 200px;
top: 185px;
}
#apDiv46 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 87px;
top: 85px;
}
#apDiv47 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 127px;
top: 105px;
}
#apDiv48 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 168px;
top: 125px;
}
#apDiv49 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 209px;
top: 146px;
}
#apDiv50 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 248px;
top: 169px;
}
#apDiv51 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 132px;
top: 69px;
}
#apDiv52 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 170px;
top: 89px;
}
#apDiv53 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 211px;
top: 109px;
}
#apDiv54 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 256px;
top: 129px;
}
#apDiv55 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 292px;
top: 151px;
}
#apDiv56 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 177px;
top: 55px;
}
#apDiv57 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 217px;
top: 74px;
}
#apDiv58 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 253px;
top: 98px;
}
#apDiv59 {
position:absolute;
width:18px;
height:39px;
z-index:3;
left: 295px;
top: 115px;
}