1
0
This commit is contained in:
Daniel Tartavel 2022-09-25 18:03:18 +02:00
parent 5af2b1a10e
commit bb7d54afc8

View File

@ -2,7 +2,6 @@
require_once '../session_init.php'; require_once '../session_init.php';
require_once 'config.inc.php'; require_once 'config.inc.php';
require_once 'db.class.php'; require_once 'db.class.php';
require_once 'entete.php';
require_once 'fonctions.inc.php'; require_once 'fonctions.inc.php';
$path = $_SERVER["PHP_SELF"]; $path = $_SERVER["PHP_SELF"];
@ -25,19 +24,36 @@ function queryVotes($db, $idVotation)
} }
$idVotation = getpost("id"); $idVotation = getpost("id");
$method = getpost("method");
$libelle = getpost("libelle");
if (!empty($idVotation)) if (!empty($idVotation))
{ {
$_SESSION["idVotation"] = $idVotation; if (!empty($method) and !empty($libelle))
$votationName = queryVotationName($db, $idVotation);
}elseif (array_key_exists("idVotation", $_SESSION))
{
if (!empty($_SESSION["idVotation"]))
{ {
$idVotation = $_SESSION["idVotation"]; $query = "INSERT INTO liste_votes VALUES (0, '" . $libelle . "', " . $method . "," . $idVotation . ")";
$db->query($query);
header("Location: " . $$base_url . "/" . $path , TRUE, 301);
return;
}else
{
$_SESSION["idVotation"] = $idVotation;
$votationName = queryVotationName($db, $idVotation); $votationName = queryVotationName($db, $idVotation);
} }
}else
{
if (array_key_exists("idVotation", $_SESSION))
{
if (!empty($_SESSION["idVotation"]))
{
$idVotation = $_SESSION["idVotation"];
$votationName = queryVotationName($db, $idVotation);
}
}
} }
require_once 'entete.php';
print('<br><br> print('<br><br>
<!-- lalis Grid Section --> <!-- lalis Grid Section -->
<section id="content"> <section id="content">
@ -58,7 +74,7 @@ if (!empty($votes))
echo EOLH . EOLH; echo EOLH . EOLH;
} }
print(' <h3>Nouveau vote pour la votation'); print('<h3>Nouveau vote pour la votation');
if (empty($idVotation)) if (empty($idVotation))
{ {
@ -66,20 +82,16 @@ if (empty($idVotation))
}else }else
{ {
print(": " . $votationName . '</h3>' . EOL); print(": " . $votationName . '</h3>' . EOL);
$method = getpost("method");
$libelle = getpost("libelle");
if (empty($method) or empty($libelle)) if (empty($method) or empty($libelle))
{ {
votesForm($path); votesForm($path);
}else }else
{ {
$query = "INSERT INTO liste_votes VALUES (0, '" . $libelle . "', " . $method . "," . $idVotation . ")";
print($query);
$db->query($query);
} }
} }
$db->close(); $db->close();
print(' </div> print(' </div>
</div> </div>
</div> </div>