1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__serveur-vote-lalis/gestion/saisieVotes.php
2022-09-29 14:04:15 +02:00

86 lines
1.7 KiB
PHP

<?php
require_once '../session_init.php';
require_once 'config.inc.php';
require_once 'db.class.php';
require_once 'fonctions.inc.php';
$path = $_SERVER["PHP_SELF"];
$db = new db();
$idVotation = getpost("idVotation");
$method = getpost("method");
$libelle = getpost("libelle");
if (!empty($idVotation))
{
if (!empty($method) and !empty($libelle))
{
$query = "INSERT INTO liste_votes VALUES (0, '" . $db->protect($libelle) . "', " . $db->protect($method) . "," . $db->protect($idVotation) . ")";
$db->query($query);
header("Location: " . $$base_url . "/" . $path , TRUE, 301);
return;
}else
{
$_SESSION["idVotation"] = $idVotation;
$votationName = $db->queryVotationName($idVotation);
}
}else
{
if (array_key_exists("idVotation", $_SESSION))
{
if (!empty($_SESSION["idVotation"]))
{
$idVotation = $_SESSION["idVotation"];
$votationName = $db->queryVotationName($idVotation);
}
}
}
require_once 'entete.php';
print('<br><br>
<!-- lalis Grid Section -->
<section id="content">
<div class="container">') . EOL;
print(' <div class="row">
<div class="col-lg-12 text-center">');
$votes = $db->queryVotes($idVotation);
if (!empty($votes))
{
print("<table><tr><td>");
print("<b>vote</b></td><td><b>méthode</b></td></tr>");
foreach ($votes as $value)
{
print ("<tr><td>" . $value["libelle"] . "</td><td>" . $value["methode"] . "</td></tr>" . EOL);
}
print("</table>" . EOL);
echo EOLH . EOLH;
}
print('<h3>Nouveau vote pour la votation');
if (empty($idVotation))
{
choixVotation($path, 0, false);
}else
{
print(": " . $votationName . '</h3>' . EOL);
if (empty($method) or empty($libelle))
{
votesForm($path);
}else
{
}
}
$db->close();
print(' </div>
</div>
</div>
</section>');
require_once("footer.html");
?>