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,11 +24,26 @@ function queryVotes($db, $idVotation)
} }
$idVotation = getpost("id"); $idVotation = getpost("id");
$method = getpost("method");
$libelle = getpost("libelle");
if (!empty($idVotation)) if (!empty($idVotation))
{
if (!empty($method) and !empty($libelle))
{
$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; $_SESSION["idVotation"] = $idVotation;
$votationName = queryVotationName($db, $idVotation); $votationName = queryVotationName($db, $idVotation);
}elseif (array_key_exists("idVotation", $_SESSION)) }
}else
{
if (array_key_exists("idVotation", $_SESSION))
{ {
if (!empty($_SESSION["idVotation"])) if (!empty($_SESSION["idVotation"]))
{ {
@ -37,7 +51,9 @@ if (!empty($idVotation))
$votationName = queryVotationName($db, $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">
@ -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>