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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
| <?php
session_start();
?>
<head>
<title>Sondage à toutes ages !</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<?php
require_once ("MDB2.php");
require_once ("Connect.php");
require_once ("Connexion.php");
require_once ("ExecRequete.php");
?></head>
<body onunload="window.history.forward();">
<!-- wrap starts here -->
<div id="wrap">
<div id="top-bg"></div>
<!--header ends-->
</div>
<br />
<!--<div id="header-photo"></div>-->
<!-- navigation starts-->
<div id="menu">
<ul>
<li id="current"><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Support</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About</a></li>
</ul>
<!-- navigation ends-->
</div>
<!-- content-wrap starts -->
<div id="content-wrap">
<div id="sidebar">
<h1>Connexion ADMIN</h1>
<?php
if(isset($_SESSION['UTILISATEUR']['LOGIN']) && ($_SESSION['UTILISATEUR']['LOGIN'] == "root"))
{
echo 'Bonjour Admin !';
echo '<br><a href="ADMIN/index_admin.php">Administration</a>';
echo '<br><a href="logout.php">déconnexion</a>';
}
else
{
echo '
<form name="login" method="post" action="index.php?page=checklogin">
<dl>
<dt>Utilisateur
<input name="myusername" type="text" id="myusername" size="10"></dt>
</dl>
<dl>
<dt>Password
<input name="mypassword" type="password" id="mypassword" size="10"></dt>
</dl>
<br>
<dl>
<dt><input type="submit" name="Submit" value="Connexion"></dt>
</dl>
';
}
?>
<h1>Links</h1>
<ul class="sidemenu">
<?php
if(isset($_SESSION['UTILISATEUR']['LOGIN']) && ($_SESSION['UTILISATEUR']['LOGIN'] != "root"))
{
echo '
<li><a href="index.php?page=visio" title="Visio">Visio</a></li>
<li><a href="index.php?page=recherche" title="Recherche">Chercher un sondage</a></li>
<li><a href="./index.php">Retour Index</a></li>';
}
else {
echo '
<li><a href="index.php?page=creation" title="Création de sondage">Créer un sondage</a></li>
<li><a href="index.php?page=stats" title="Statistiques des réponses">Statistiques</a></li>
<li><a href="index.php?page=modif" title="Modification d\'un sondage">Modifier un sondage</a></li>
<li><a href="index.php?page=recherche" title="Recherche">Chercher un sondage</a></li>
<li><a href="index.php?page=visio" title="Participé !">Retour Index</a></li>';
}
?>
</ul>
</div>
<div id="main">
<p>
<?php
//echo '<br>'.$_SESSION['UTILISATEUR']['LOGIN'].'<br>';
//echo '<hr>';
// On dfinit le tableau contenant les pages autorises
// ----------------------------------------------------
if(isset($_SESSION['UTILISATEUR']['LOGIN']) && ($_SESSION['UTILISATEUR']['LOGIN'] == "root"))
{
$pageOK = array('visio' => 'visio.php',
'particip' => 'particip.php',
'contact' => 'contact.php',
'recherche' => 'recherche.php',
'creation' => 'ADMIN/creation.php',
'modif' => 'ADMIN/modif.php',
'prevu' => 'ADMIN/prevu.php',
'stats' => 'ADMIN/stats.php');
$actionOK = array('supprimer' => 'supprimer');
}
else {
$pageOK = array('visio' => 'visio.php',
'checklogin' => 'checklogin.php',
'particip' => 'particip.php',
'recherche' => 'recherche.php',
'contact' => 'contact.php');
}
// On teste que le paramtre d'url existe et qu'il est bien autorisé
// -----------------------------------------------------------------
if ( (isset($_GET['page'])) && (isset($pageOK[$_GET['page']])) && (isset($_GET['action'])) && (isset($actionOK[$_GET['action']])) && (isset($_GET['id_ques'])) && (isset($_GET['id_sond'])) && (isset($_GET['intitule'])) && (isset($_GET['date_crea'])) && (isset($_GET['date_close'])) ) {
//Connexion a la base !
$connexion = Connexion(NOM,PASSE,BASE,SERVEUR);
$requete="DELETE FROM participation WHERE id_ques='".$_GET['id_ques']."';";
$resultat = Execrequete($requete,$connexion);
$requete="DELETE FROM reponse WHERE id_ques='".$_GET['id_ques']."';";
$resultat = Execrequete($requete,$connexion);
$requete="DELETE FROM question WHERE id_ques='".$_GET['id_ques']."';";
$resultat = Execrequete($requete,$connexion);
$requete="UPDATE sondage SET nb_ques = nb_ques-1 WHERE id_sond = '".$_GET['id_sond']."';";
$resultat = Execrequete($requete,$connexion);
$_POST['modifier']='Modifier';
$_POST['id_sond']=$_GET['id_sond'];
$_POST['id_ques']=$_GET['id_ques'];
$_POST['intitule']=$_GET['intitule'];
$_POST['date_crea']=$_GET['date_crea'];
$_POST['date_close']=$_GET['date_close'];
$_POST['nb_ques']=$_GET['nb_ques']-1;
echo 'LE GET SA PASSE !!!!!!!!!';
}
//if ( (isset($_GET['page'])) ) {
if ( (isset($_GET['page'])) && (isset($pageOK[$_GET['page']])) ) {
include($pageOK[$_GET['page']]); // Nous appelons le contenu central de la page
}
else include('visio.php'); // Page par dfaut quant elle n'existe pas dans le tableau
?>
</p>
</div>
<!-- content-wrap ends-->
</div>
</div>
</body></html> |
Partager