game/onyx/hb_game/jeu/accueil.php

45 lines
2.5 KiB
PHP
Raw Normal View History

2008-11-17 11:00:00 +00:00
<?php
if(!defined('INDEX')) { header('Location: ../'); exit; }
$page = 'accueil';
$titre = 'Accueil';
2008-11-22 11:00:00 +00:00
//On recherche si le joueur a des messages non lus
2008-11-17 11:00:00 +00:00
$pseudo = trouvNom($id_user);
2008-11-04 11:00:00 +00:00
$bdd->connexion();
$queryMail = $bdd->unique_query("SELECT COUNT(*) AS nbre FROM $table_mail WHERE destinataire = '$pseudo' AND vu = '1';");
2008-11-17 11:00:00 +00:00
2008-11-22 11:00:00 +00:00
//On regarde si le joueur a une attaque en vue
2008-11-17 11:00:00 +00:00
$attaquesRadar = array();
2008-11-22 11:00:00 +00:00
$nbPlan = count($queryPlanetes);
for($i = 0; $i < $nbPlan; $i++){
$end_galaxie = $queryPlanetes[$i]['galaxie'];
$end_ss = $queryPlanetes[$i]['ss'];
$end_position = $queryPlanetes[$i]['position'];
2008-11-04 11:00:00 +00:00
$resultatf = $bdd->query("SELECT * FROM $table_flottes WHERE mission = '1' AND end_galaxie = '$end_galaxie' AND end_ss = '$end_ss' AND end_position = '$end_position';");
$nbF = $bdd->num_rows;
2008-11-22 11:00:00 +00:00
for ($j = 0; $j < $nbF; $j++) {
2008-11-30 11:00:00 +00:00
$start_galaxie = $resultatf[$j]['start_galaxie'];
$start_ss = $resultatf[$j]['start_ss'];
$start_position = $resultatf[$j]['start_position'];
if ($resultatf[$j]['start_time'] + $resultatf[$j]['end_time'] < time() + $queryUser['detection']*1800) {
2008-11-04 11:00:00 +00:00
$resultatp = $bdd->unique_query("SELECT nom_planete FROM $table_planete WHERE galaxie = '$start_galaxie' AND ss = '$start_ss' AND position = '$start_position'");
$resultatpm = $bdd->unique_query("SELECT nom_planete FROM $table_planete WHERE galaxie = '$end_galaxie' AND ss = '$end_ss' AND position = '$end_position'");
2008-11-30 11:00:00 +00:00
$attaquesRadar[] = array(htmlspecialchars($resultatp['nom_planete']), $resultatf[$j]['start_time']+$resultatf[$j]['end_time']-time()<0?'COMBAT EN COURS':affTemp($resultatf[$j]['start_time']+$resultatf[$j]['end_time']-time()), $resultatf[$j]['start_galaxie'], $resultatf[$j]['start_ss'], $resultatf[$j]['start_position'], htmlspecialchars($resultatpm['nom_planete']), $resultatf[$j]['end_galaxie'], $resultatf[$j]['end_ss'], $resultatf[$j]['end_position'], ($resultatf[$j]['start_time']+$resultatf[$j]['end_time']-time())<0?'':$resultatf[$j]['start_time']+$resultatf[$j]['end_time']-time());
2008-11-17 11:00:00 +00:00
}
}
}
2008-11-04 11:00:00 +00:00
//Affichage de l'alliance du joueur
$alli = $bdd->unique_query("SELECT * FROM $table_alliances WHERE id = '".$queryUser['id_alliance']."';");
$bdd->deconnexion();
2008-11-22 11:00:00 +00:00
//Affichage des informations sur la planète
2008-11-17 11:00:00 +00:00
$diametre = separerNombres($queryPlanete['cases'] * 92);
$Classpoints = separerNombres($queryUser['points']);
2008-11-04 11:00:00 +00:00
$template->assign('mail', $queryMail);
2008-11-17 11:00:00 +00:00
$template->assign('attaques',$attaquesRadar);
$template->assign('diametre',$diametre);
$template->assign('points',$Classpoints);
2008-11-18 11:00:00 +00:00
$template->assign('alliance', $alli);
2008-11-17 11:00:00 +00:00
?>