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

71 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2022-09-25 23:06:35 +02:00
<?php
2022-10-19 15:51:41 +02:00
require_once '../session_init.php';
2022-09-25 23:06:35 +02:00
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");
2022-09-29 11:32:23 +02:00
$idCandidat = getpost("idCandidat");
2022-09-26 11:39:41 +02:00
$libelle = getpost("libelle");
2022-09-25 23:06:35 +02:00
2022-10-19 15:51:41 +02:00
if (!empty($candidat))
2022-09-25 23:06:35 +02:00
{
2022-09-26 11:54:58 +02:00
$query = "INSERT INTO liste_candidats VALUES (0, " . $db->protect($idVotation) . ", " . $db->protect($idVote) . ",'" . $db->protect($libelle) . "', '". $db->protect($candidat) . "')";
2022-09-25 23:06:35 +02:00
$db->query($query);
2022-09-26 11:56:54 +02:00
header("Location: " . $base_url . "/" . $path , TRUE, 301);
2022-09-25 23:06:35 +02:00
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);
2022-10-19 15:51:41 +02:00
}elseif (!empty($idCandidat))
2022-09-29 11:32:23 +02:00
{
2022-09-26 10:42:47 +02:00
}else
{
2022-09-26 10:53:45 +02:00
$votationName = $db->queryVotationName($idVotation);
$voteName = $db->queryVoteName($idVote);
$candidatsList = $db->queryCandidatsList($idVotation, $idVote);
2022-09-26 11:39:41 +02:00
2022-09-28 11:51:31 +02:00
print('<h3>Nouveau candidat pour le vote "' . $voteName . '" de la votation "' . $votationName . '"</h3>' . EOLH);
2022-09-26 11:39:41 +02:00
if (empty($candidatsList))
{
print("Aucun candidats saisi pour l'instant" . EOLH);
}else
2022-09-26 10:53:45 +02:00
{
2022-09-28 11:51:31 +02:00
print('<h4>Liste des candidats</h4>');
2022-09-26 11:39:41 +02:00
foreach($candidatsList as $line)
{
2022-09-28 11:51:31 +02:00
print(nl2br($line["libelle"]) . EOLH);
2022-10-19 15:51:41 +02:00
print("<b><u>" . $line["candidat"] . "</u></b><br>");
2022-09-26 11:39:41 +02:00
}
2022-09-26 10:53:45 +02:00
}
2022-09-26 10:42:47 +02:00
candidatsForm($path, $idVotation, $idVote);
2022-09-25 23:06:35 +02:00
}
print(' </div>
</div>
</div>
</section>');
require_once("footer.html");
}
$db->close();
2022-09-29 11:32:23 +02:00
?>