1
0
This commit is contained in:
2022-10-19 15:51:41 +02:00
parent e89dcf2cc7
commit 7422d5c89b
9 changed files with 173 additions and 119 deletions

View File

@ -5,14 +5,15 @@ require_once 'config.inc.php';
require_once 'db.class.php';
require_once "log.php";
require_once 'entete.php';
require_once 'fonctions.inc.php';
$idVotant = trim(base64_decode(urldecode($_GET["id"])), " \n\r");
$idVotation = $_GET["v"];
$idVotant = trim(base64_decode(urldecode(getpost("id")), " \n\r"));
$idVotation = getpost("v");
$dolibarr = new dbDolibarr();
$query = "SELECT * FROM llx_adherent as a LEFT JOIN llx_adherent_type as t ON a.fk_adherent_type=t.rowid WHERE a.login='" . $dolibarr->protect($idVotant) . "' AND (DATE(a.datefin)>=CURDATE() OR t.subscription=0) AND t.vote=1";
print $query . EOLH;
//print $query . EOLH;
$result = $dolibarr->query($query);
//print_r($dolibarr);
$votant = $dolibarr->result->fetch_array();
@ -46,7 +47,7 @@ if ($dolibarr->result->num_rows == 0)
{
if ( time() >= $votation['td'] AND time() <= $votation['tf'] )
{
$query = "SELECT * FROM votes WHERE idVotant='" . $db->protect($idVotant) ."'";
$query = "SELECT * FROM votes WHERE idVotant='" . $db->protect($idVotant) ."' AND idVotation=" . $idVotation;
$db->query($query);
if ($db->result->num_rows == 0)
{
@ -70,8 +71,9 @@ if ($dolibarr->result->num_rows == 0)
echo "<pre>";
foreach($candidats as $candidat)
{
echo '<input type="radio" name="vote[' . $vote["id"] . ']" value="' . $candidat["id"] . '"> ' . $candidat["candidat"] . '&nbsp;<br>';
echo nl2br($candidat["libelle"]) . EOLH;
echo '<input type="radio" name="vote[' . $vote["id"] . ']" value="' . $candidat["id"] . '"> ' . $candidat["candidat"] . '&nbsp;<br>';
}
echo '<input type="radio" name="vote[' . $vote["id"] . ']" value="0"> Vote blanc&nbsp;<br>';
print "</pre>