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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
<?php session_start();?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<title>FootClic</title>
</head>
<body>
<header>
<div id="titre">
<img src="images/Ballon.gif" alt="" id="logo"/>
<h1> FootClic </h1></br>
<h3> Actus et Sondages sur le Football </h3>
</div>
<nav>
<ul>
<li><a href="FootClic.php">ACCUEIL</a></li>
<li><a href="debatsfootclic.php">ACTUS</a></li>
<li><a href="#">SONDAGES</a></li>
<?php
if (isset($_SESSION['pseudo']))
echo "<li><a href=\"Pronos.php\">PRONOS</a></li><li><a href=\"decofootclic.php\">DECONNEXION</a></li>";
else
echo '<li><a href="inscriptionfootclic.php">INSCRIPTION</a></li> <li><a href="connexionfootclic.php">CONNEXION</a></li>';
if (isset($_SESSION['pseudo']) && $_SESSION['pseudo'] == 'JBen')
echo "<li><a href=\"Admin.php\">ADMIN</a></li>";
else
echo '';
?>
</ul>
</nav>
</header>
<div id="banniere_image">
</div>
<section>
<article>
<form method="post" action="" id="pronos">
<?php
// Connexion au serveur MySQL
$db=mysql_connect("localhost","root","")or die("Erreur de connexion au serveur");
// Connexion à la base devillersbdd
mysql_select_db("footclic",$db)or die ("Erreur de connexion à la base footclic");
//afficher matchs
if (isset($_GET['id_match']))
{
$id_match=$_GET['id_match'];
$equipe_domicile=$_GET['equipe_dom'];
$equipe_exterieur=$_GET['equipe_ext'];
$sql=("SELECT equipe_domicile, libelle FROM `match`, `equipe` WHERE match_id='$id_match' and match.equipe_domicile=equipe.id_equipe");
$query=mysql_query($sql);
$result=mysql_fetch_assoc($query);
$equipe = $result['equipe_domicile'];
echo '<h4>'.$result['libelle'].' - ';
$sql2=("SELECT libelle FROM `match`, `equipe` WHERE match_id='$id_match' and match.equipe_exterieur=equipe.id_equipe and equipe_domicile='$equipe'");
$query2=mysql_query($sql2);
$result2 = mysql_fetch_assoc($query2);
echo $result2['libelle'].'</h4>';
echo '<input type="radio" name="pronostic" value="1" >'.$result['libelle']. '</br>';
echo ' <input type="radio" name="pronostic" value="N" >Match Nul</br>';
echo '<input type="radio" name="pronostic" value="2">'.$result2['libelle'].'</br>';
echo '<input type="submit" value="Parier" /></br>';
// Paris OK!
if(isset($_POST['pronostic']))
{
$val = $_POST['pronostic'];
$pronos = 'pronostic_'.$val;
$sql5 = "SELECT $pronos FROM `pronos` WHERE `match_id` = ".$id_match;
$req5 = mysql_query($sql5) or die(erreurMySQL($sql5, mysql_error()));
$result5 = mysql_fetch_assoc($req5);
$increment = $result5[''.$pronos.''] + 1;
$sql4 = "UPDATE `pronos` SET `pronostic_".$val."` = $increment WHERE `match_id` = ".$id_match;
$req = mysql_query($sql4) or die(erreurMySQL($sql4, mysql_error()));
//Afficher confirmation
echo "<p style='color: blue'>$increment personnes ont voté comme toi !</p>";
// Déjà Parié !
}
}
?>
</article>
</section>
<footer>
<div id="login">
<?php if(isset($_SESSION['pseudo'])) echo $_SESSION['pseudo'];?>
</div>
</footer>
</html> |
Partager