2008-11-17 11:00:00 +00:00
< ? php
if ( ! defined ( 'INDEX' )) { header ( 'Location: ../' ); exit ; }
$page = 'carte' ;
$titre = 'Carte spatiale' ;
2008-11-04 11:00:00 +00:00
if ( isset ( $_GET [ 'galaxie' ])) $g = floor ( $_GET [ 'galaxie' ]);
2008-11-22 11:00:00 +00:00
else $g = $queryPlanete [ 'galaxie' ];
2008-11-04 11:00:00 +00:00
if ( $queryUser [ 'auth_level' ] >= 5 && $g <= 0 ) $g = 0 ;
2008-11-22 11:00:00 +00:00
elseif ( $g < 1 ) $g = 1 ;
2008-11-18 11:00:00 +00:00
if ( $g > MAX_AMAS ) $g = 1 ;
2008-11-17 11:00:00 +00:00
2008-11-04 11:00:00 +00:00
if ( isset ( $_GET [ 'ss' ])) $s = floor ( $_GET [ 'ss' ]);
2008-11-22 11:00:00 +00:00
else $s = $queryPlanete [ 'ss' ];
2008-11-17 11:00:00 +00:00
if ( $s < 1 ) $s = 1 ;
2008-11-18 11:00:00 +00:00
if ( $s > MAX_SYSTEME ) $s = MAX_SYSTEME ;
2008-11-17 11:00:00 +00:00
if ( $s == 1 && $g > 1 ) {
$Gmu = $g - 1 ;
2008-11-18 11:00:00 +00:00
$Smu = MAX_SYSTEME ;
2008-11-17 11:00:00 +00:00
}
elseif ( $s == 1 ) {
$Gmu = 15 ;
2008-11-18 11:00:00 +00:00
$Smu = MAX_SYSTEME ;
2008-11-17 11:00:00 +00:00
}
else {
$Gmu = $g ;
$Smu = $s - 1 ;
}
2008-11-18 11:00:00 +00:00
if ( $s == MAX_SYSTEME ) {
2008-11-17 11:00:00 +00:00
$Gpu = $g + 1 ;
$Spu = 1 ;
}
else {
$Gpu = $g ;
$Spu = $s + 1 ;
}
$TEMP_carte = array ();
2008-11-22 11:00:00 +00:00
for ( $i = 1 ; $i <= MAX_PLANETE ; $i ++ ) {
2008-11-04 11:00:00 +00:00
$bdd -> connexion ();
$bdd -> escape ( $g );
$bdd -> escape ( $s );
$resultat = $bdd -> query ( " SELECT id FROM $table_planete WHERE galaxie = ' $g ' AND ss = ' $s ' AND position = ' $i '; " );
2008-11-22 11:00:00 +00:00
if ( $resultat ) {
2008-11-16 11:00:00 +00:00
$d = $bdd -> unique_query ( " SELECT id_user, nom_planete, debris_met, debris_cri FROM $table_planete WHERE galaxie = ' $g ' AND ss = ' $s ' AND position = ' $i '; " );
2008-11-17 11:00:00 +00:00
$id_user = $d [ 'id_user' ];
2008-11-04 11:00:00 +00:00
$e = $bdd -> unique_query ( " SELECT pseudo, race, id_alliance FROM $table_user WHERE id = ' $id_user ' " );
2008-11-16 11:00:00 +00:00
if ( $e [ 'id_alliance' ]) {
$alliId = $e [ 'id_alliance' ];
$eA = $bdd -> unique_query ( " SELECT tag FROM $table_alliances WHERE id = ' $alliId '; " );
}
2008-11-04 11:00:00 +00:00
else $eA = false ;
$bdd -> deconnexion ();
2008-11-22 11:00:00 +00:00
if ( $e [ 'race' ] == 'covenant' ) $ra = '(c)' ;
elseif ( $auth_level >= 6 && md5 ( $e [ 'race' ]) == '34c19b21bd4a3dda389e767d32fe9779' ) $ra = '(f)' ;
else $ra = '(h)' ;
2008-11-17 11:00:00 +00:00
2008-11-04 11:00:00 +00:00
$TEMP_carte [] = array ( $i , htmlspecialchars ( $d [ 'nom_planete' ]), $d [ 'debris_met' ], $d [ 'debris_cri' ], $ra , $e [ 'pseudo' ], '<a href="?p=envoyer&d=' . $e [ 'pseudo' ] . '" class="msg"><span>Message</span></a>' , $eA [ 'tag' ]);
}
else {
$bdd -> deconnexion ();
$TEMP_carte [] = array ( $i );
2008-11-17 11:00:00 +00:00
}
}
$template -> assign ( 'carte' , $TEMP_carte );
$template -> assign ( 'position' , array ( $g , $s , $Gpu , $Spu , $Gmu , $Smu ));
?>