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/saisieCandidats.php
2022-10-05 20:39:12 +02:00

72 lines
1.8 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");
$idVote = getpost("idVote");
$candidat = getpost("candidat");
$idCandidat = getpost("idCandidat");
$libelle = getpost("libelle");
$action = getpost("action");
if (!empty($candidat) and $action != "modif")
{
$query = "INSERT INTO liste_candidats VALUES (0, " . $db->protect($idVotation) . ", " . $db->protect($idVote) . ",'" . $db->protect($libelle) . "', '". $db->protect($candidat) . "')";
$db->query($query);
header("Location: " . $base_url . "/" . $path , TRUE, 301);
return;
}else
{
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">');
if (empty($idVotation))
{
choixVotation($path, 0, false);
}elseif (empty($idVote))
{
choixVote($path, $idVotation);
}elseif ($action == "modif" and !empty($idCandidat))
{
}else
{
$votationName = $db->queryVotationName($idVotation);
$voteName = $db->queryVoteName($idVote);
$candidatsList = $db->queryCandidatsList($idVotation, $idVote);
print('<h3>Nouveau candidat pour le vote "' . $voteName . '" de la votation "' . $votationName . '"</h3>' . EOLH);
if (empty($candidatsList))
{
print("Aucun candidats saisi pour l'instant" . EOLH);
}else
{
print('<h4>Liste des candidats</h4>');
foreach($candidatsList as $line)
{
print("<b><u>" . $line["candidat"] . "</u></b><br>");
print(nl2br($line["libelle"]) . EOLH);
}
}
candidatsForm($path, $idVotation, $idVote);
}
print(' </div>
</div>
</div>
</section>');
require_once("footer.html");
}
$db->close();
?>