game/pages/voir_classement.php

92 lines
3.4 KiB
PHP
Raw Normal View History

2007-10-27 10:00:00 +00:00
<?php
2008-11-19 11:00:00 +00:00
session_start();
2007-11-21 11:00:00 +00:00
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
$race=$_SESSION['race'];
$_SESSION['dernPage'] = '';
2008-11-19 11:00:00 +00:00
include_once('common.php');
2007-11-21 11:00:00 +00:00
require('../connectBDD.php');
require('../template.php');
2008-11-19 11:00:00 +00:00
$template = new Template('../templates/');
2007-11-21 11:00:00 +00:00
$template->set_filenames(array('stat_body' => 'stat_body.tpl','stat_playertable'=>'stat_playertable.tpl', 'stat_playertable_header'=>'stat_playertable_header.tpl' ,'stat_playertable_footer'=>'stat_playertable_footer.tpl'));
// Nombre de joueur affich<63> par page de classement
$nbppage = 100;
if (isset($_POST['type'])) $type = $_POST['type'];
else $type = 'points';
$parse = $lang;
$who = (isset($_POST["who"]))?$_POST["who"]:$_GET["who"];
$numpage = $start = (isset($_POST["start"]))?(floor($_POST["start"])*$nbppage):0;
echo'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
2007-03-31 10:00:00 +00:00
<head>
2007-11-03 11:00:00 +00:00
<title>Halo battle</title>
2007-11-21 11:00:00 +00:00
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=windows-1252" />
<link rel="stylesheet" media="screen" type="text/css" title="design" href="descriptions/diz/base.css" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="content-type" content="text/html;charset=iso-8869-1" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
2007-10-27 10:00:00 +00:00
2007-11-21 11:00:00 +00:00
<style type="text/css">
2007-10-27 10:00:00 +00:00
table {
margin-top: 25px;
}
TD.z {
min-width: 15px;
}
</style>
</head>
2007-11-21 11:00:00 +00:00
<body>';
2007-03-31 10:00:00 +00:00
2007-11-21 11:00:00 +00:00
$parse['who'] = '
<option value="player"'.(($who == "player") ? " selected=\"selected\"" : "").'>Pseudo</option>
<option value="ally"'.(($who == "ally") ? " selected=\"selected\"" : "").'>Alliance</option>';
if (!isset($type)) $type='pts';
$parse['type'] = '
<option value="points"'.(($type == "points") ? " selected=\"selected\"" : "").'>Points</option>
<option value="batiments"'.(($type == "batiments") ? " selected=\"selected\"" : "").'>Batiment</option>
<option value="flottes"'.(($type == "flottes") ? " selected=\"selected\"" : "").'>Flotte</option>
<option value="recherches"'.(($type == "recherches") ? " selected=\"selected\"" : "").'>Recherches</option>';
if (!isset($start)) $start='0';
if($who == "ally"){
}
else {
$test = mysql_query("SELECT * FROM classement");
$nb = mysql_num_rows($test);
$parse['start'] = '';
for ($c=0; $c*$nbppage<$nb ; $c++) {
$parse['start'] .= '<option value="'.$c.'"'.(($numpage/$nbppage == $c) ? " selected=\"selected\"" : "").'>'.($c*$nbppage+1).'-'.(($c+1)*$nbppage).'</option>';
}
$test = mysql_query("SELECT * FROM classement ORDER BY $type DESC LIMIT $numpage, $nbppage");
$i=$numpage+1;
$template->assign_vars( array('who' => $parse['who'],'type' => $parse['type'], 'start' => $parse['start']));
$template->pparse('stat_body');
$template->assign_vars( array('who' => $parse['who'],'type' => $parse['type'], 'start' => $parse['start'], 'body_table' => $parse['body_table']));
$template->pparse('stat_playertable_header');
2007-03-31 10:00:00 +00:00
2007-11-21 11:00:00 +00:00
while ($row = mysql_fetch_assoc($test)){
2008-11-20 11:00:00 +00:00
$table = $template->assign_vars( array('player_rank' => separerNombres($i), 'player_name' => $row['pseudo'], 'player_points' => separerNombres($row[$type]), 'player_mes'=> '<a href="messagerie.php?act=nouv&joueur='.$row['pseudo'].'"><img src="descriptions/diz/m.gif" alt="Envoyer un message priv<69>" /></a>'));
2007-11-21 11:00:00 +00:00
$parse['body_values'] .= $template->pparse('stat_playertable');
$i++;
}
2007-03-31 10:00:00 +00:00
}
2007-11-03 11:00:00 +00:00
2007-11-21 11:00:00 +00:00
$template->pparse('stat_playertable_footer');
echo '</table></body></html>';
2007-11-03 11:00:00 +00:00
?>