1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| <?php
include('config.php')
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Espace membre</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Espace Membre" /></a>
</div>
<div class="content">
<?php
//On affiche un message de bienvenue, si lutilisateur est connecte, on affiche son pseudo
?>
Bonjour<?php if(isset($_SESSION['username'])){echo ' '.htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8');} ?>,<br />
Bienvenue sur notre site.<br />
Vous pouvez <a href="users.php">voir la liste des utilisateurs</a>.<br /><br/>
<?php
//Si lutilisateur est connecte, on lui donne un lien pour modifier ses informations, pour voir ses messages et un pour se deconnecter
if(isset($_SESSION['username']))
{
?>
<a href="edit_infos.php">Modifier mes informations personnelles</a><br />
<a href="connexion.php">Se déconnecter</a><br/><br><br/>
<?php
$sql = "SELECT id,eq1,eq2,date, DATE_FORMAT(date,'%d/%m/%Y %H:%i') AS date2 FROM matchs";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$user= $_SESSION['username'];
echo '<form action="index.php" method="post">';
while($data = mysql_fetch_assoc($req))
{
// on affiche les informations de l'enregistrement en cours
echo ''.$data['date2'].' ';
echo ''.$data['eq1'].' ';
// Variable qui ajoutera l'attribut selected de la liste déroulante
$selected = '';
$selected2 = '';
// Parcours du tableau
echo '<select name="'.$user.'.'.$data['id'].'.1">',"\n";
for($i=0; $i<=10; $i++)
{
// Affichage de la ligne
echo "\t",'<option value="', $i ,'"', $selected ,'>', $i ,'</option>',"\n";
// Remise à zéro de $selected
$selected='';
}
echo '<select name="'.$user.'.'.$data['id'].'.1">',"\n";
echo ''.$data['eq2'].' ';
echo '<select name="'.$user.'.'.$data['id'].'.2">',"\n";
for($j=0; $j<=10; $j++)
{
// Affichage de la ligne
echo "\t",'<option value="', $j ,'"', $selected2 ,'>', $j ,'</option>',"\n";
// Remise à zéro de $selected
$selected2='';
}
echo '<select name="'.$user.'.'.$data['id'].'">',"\n";
echo '<input name="btn_'.$user.'.'.$data['id'].'" type="submit" value="OK"">';
if (isset ($_POST['btn_'.$user.'.'.$data['id'].'']))
{
$req2 = mysql_query("INSERT INTO `matchs` (`id`,`eq1`, `eq2`, `groupe`, `date`,`score_eq1`,`score_eq2`) VALUES ('1','POLOGNE', 'GRECE','GROUPE A', '2012-06-08 18:00:00', '', '')");
}
echo '<br></br>';
}
echo '</form>';
// on ferme la connexion à mysql
//mysql_close();
?>
<?php
}
else
{
//Sinon, on lui donne un lien pour sinscrire et un autre pour se connecter
?>
<a href="sign_up.php">Inscription</a><br />
<a href="connexion.php">Se connecter</a>
<?php
}
?>
</div>
<div class="foot"><a href="http://www.supportduweb.com/">Support du Web</a></div>
</body>
</html> |
Partager