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

86 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2022-09-21 14:47:18 +02:00
<?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();
2022-09-25 23:21:14 +02:00
$idVotation = getpost("idVotation");
2022-09-25 18:03:18 +02:00
$method = getpost("method");
$libelle = getpost("libelle");
2022-09-21 14:47:18 +02:00
if (!empty($idVotation))
{
2022-09-25 18:03:18 +02:00
if (!empty($method) and !empty($libelle))
2022-09-21 14:47:18 +02:00
{
2022-09-26 11:54:58 +02:00
$query = "INSERT INTO liste_votes VALUES (0, '" . $db->protect($libelle) . "', " . $db->protect($method) . "," . $db->protect($idVotation) . ")";
2022-09-25 18:03:18 +02:00
$db->query($query);
header("Location: " . $$base_url . "/" . $path , TRUE, 301);
return;
}else
{
$_SESSION["idVotation"] = $idVotation;
2022-09-29 14:04:15 +02:00
$votationName = $db->queryVotationName($idVotation);
2022-09-21 14:47:18 +02:00
}
2022-09-25 18:03:18 +02:00
}else
{
if (array_key_exists("idVotation", $_SESSION))
{
if (!empty($_SESSION["idVotation"]))
{
$idVotation = $_SESSION["idVotation"];
2022-09-29 14:04:15 +02:00
$votationName = $db->queryVotationName($idVotation);
2022-09-25 18:03:18 +02:00
}
}
2022-09-21 14:47:18 +02:00
}
2022-09-25 18:03:18 +02:00
require_once 'entete.php';
2022-09-21 14:47:18 +02:00
print('<br><br>
<!-- lalis Grid Section -->
<section id="content">
<div class="container">') . EOL;
print(' <div class="row">
2022-09-21 21:05:44 +02:00
<div class="col-lg-12 text-center">');
2022-09-25 15:51:09 +02:00
2022-09-29 14:04:15 +02:00
$votes = $db->queryVotes($idVotation);
2022-09-21 21:12:49 +02:00
if (!empty($votes))
2022-09-21 21:05:44 +02:00
{
2022-09-25 15:51:09 +02:00
print("<table><tr><td>");
2022-09-25 18:11:42 +02:00
print("<b>vote</b></td><td><b>méthode</b></td></tr>");
2022-09-21 21:12:49 +02:00
foreach ($votes as $value)
{
2022-09-29 11:32:23 +02:00
print ("<tr><td>" . $value["libelle"] . "</td><td>" . $value["methode"] . "</td></tr>" . EOL);
2022-09-21 21:12:49 +02:00
}
2022-09-25 15:55:04 +02:00
print("</table>" . EOL);
2022-09-21 21:05:44 +02:00
echo EOLH . EOLH;
2022-09-21 21:12:49 +02:00
}
2022-09-21 21:05:44 +02:00
2022-09-25 18:03:18 +02:00
print('<h3>Nouveau vote pour la votation');
2022-09-21 14:47:18 +02:00
if (empty($idVotation))
{
choixVotation($path, 0, false);
}else
{
print(": " . $votationName . '</h3>' . EOL);
2022-09-25 18:03:18 +02:00
2022-09-21 14:47:18 +02:00
if (empty($method) or empty($libelle))
{
votesForm($path);
}else
{
2022-09-25 18:03:18 +02:00
2022-09-21 14:47:18 +02:00
}
}
$db->close();
print(' </div>
</div>
</div>
</section>');
require_once("footer.html");
?>