21-03-2008, 08:48 PM
(Modification du message : 21-03-2008, 08:49 PM par blackdemon.)
Code PHP :
<?php
mysql_connect("localhost","****", "*******");
mysql_select_db("******");
$pseudo_membre = $_SESSION['pseudo'];
$requete = mysql_query("SELECT * FROM utilisateurs WHERE `pseudo`='$pseudo_membre'") or die(mysql_error());
$var = mysql_fetch_array ($requete);
$id = $var['id'];
$pseudo = $var['pseudo'];
$requete2 = mysql_query("SELECT * FROM table_carte WHERE `pseudo`='$pseudo_membre'") or die(mysql_error());
$var2 = mysql_fetch_array ($requete2);
$galaxie = $var2['galaxie'];
$systeme = $var2['systeme'];
$position = $var2['position'];
if (isset($_POST['galaxie_select']) and isset($_POST['systeme_select']))
{
$galaxie = $_POST['galaxie_select'];
$systeme = $_POST['systeme_select'];
}
else
{
$galaxie = $_POST['galaxie_select'];
$systeme = $_POST['systeme_select'];
}
echo '<form action="galaxie.php" method="post">'."\n";
echo 'Galaxie : ';
echo '<select name="galaxie_select">'."\n";
for($galaxie_select=1;$galaxie_select<=2;$galaxie_select++)
{
if ($galaxie_select == $galaxie)
{
$selected = 'selected';
}
else
{
$selected = '';
}
echo '<option value="'.$galaxie_select.'"'.$selected.'>'.$galaxie_select.'</option>'."\n";
}
echo '</select>'."\n";
echo ' - Systeme : '."\n";
echo '<select name="systeme_select">'."\n";
for($systeme_select=1;$systeme_select<=1;$systeme_select++)
{
if ($systeme_select == $systeme)
{
$selected = 'selected';
}
else
{
$selected = '';
}
echo '<option value="'.$systeme_select.'"'.$selected.'>'.$systeme_select.'</option>'."\n";
}
echo '</select>'."\n";
echo '<br><br>'."\n";
echo '<input type="submit" value="Changer de carte"></form>'."\n";
$sql = mysql_query("SELECT 'pseudo', 'galaxie', 'systeme', 'position' FROM utilisateurs WHERE galaxie ='".$galaxie."' and systeme ='".$systeme."' ORDER BY position DESC") or die(mysql_error());
while ($data = mysql_fetch_array($sql)) {
$TabMAP[$data['position']] = $data['position'];
$TabMAP2[$data['position']] = $data['pseudo'];
}
mysql_free_result($sql);
echo '<br><br><table width="300" border="1" cellspacing="0" cellpadding="0" align="center" height="300">'."\n";
$pos=1;
for($posx=1;$posx<=5;$posx++){
echo '<tr align="center" valign="middle" height="60">'."\n";
for($posy=1;$posy<=5;$posy++){
if ($pos == 13){
echo '<th align="center" valign="middle" width="60" height="60"><img src="soleil.jpg" alt="soleil" height="60" width="60"></td>'."\n";
}
else
if(!empty($TabMAP[$pos])){
echo '<td align="center" valign="middle" width="60" height="60"><img src="planete.jpg" alt='.$TabMAP2[$pos].' height="60" width="60"></td>'."\n";
}
else
{
echo '<td align="center" valign="middle" width="60" height="60">'.$pos.'</td>'."\n";
}
$pos++;
}
echo '</tr>'."\n";
}
echo '</table>'."\n";
mysql_close();
?>
Voici mon code et franchement merci de votre soutient la jeuphp est sur ma liste rouge quasi personne ne dédaigne me répondre depuis des jours et des jours ...