diff --git a/gestionsite/saisieVotes.php b/gestionsite/saisieVotes.php index fec7412..55a9a11 100644 --- a/gestionsite/saisieVotes.php +++ b/gestionsite/saisieVotes.php @@ -23,7 +23,7 @@ if (array_key_exists("idVotation", $GLOBALS) and empty($idVotation)) if (empty($idVotation)) { - choixVotation($path); + choixVotation($path, 1, false); } $method = getpost("method"); diff --git a/include/fonctions.inc.php b/include/fonctions.inc.php index de7ec8b..6c529ae 100644 --- a/include/fonctions.inc.php +++ b/include/fonctions.inc.php @@ -46,8 +46,9 @@ function mb_ucfirst($str) function choixVotation($path, $methode = 2, $confirm = true) //2 = toutes les votations 1 = votations en cours 0 = votations cloturées { - global $db, $base_url, $action; + global $base_url, $action; + $db = new db(); $query = "SELECT * FROM liste_votations"; if ($methode != 2) { @@ -82,6 +83,7 @@ function choixVotation($path, $methode = 2, $confirm = true) //2 = toutes les v '; + $db->close; } function votationForm($path, $titre="", $libelle="", $dateDebut="", $DateFin="", $status=0) @@ -133,6 +135,7 @@ function votesForm($path, $libelle = "", $method = 0) print('') . EOL; print('') . EOL; print('') . EOL; + $db->close(); } function envoiMail($destinataire, $sujet, $text, $html=false, $cc='', $bcc='') @@ -219,10 +222,11 @@ function listeAdherents() function listeVotants($idVotation, $idVote, $listeAdherents) { - global $db; $nv = 0; $text = ''; + $db->open(); + $query = "SELECT DISTINCT idVotant FROM votes WHERE idVotation=" . $idVotation . ' AND idVote=' . $idVote; $result = $db->query($query); @@ -233,6 +237,7 @@ function listeVotants($idVotation, $idVote, $listeAdherents) } print('Nombre de votants : ' . $nv . EOLH . ''); print('' . EOLH); + $db->close(); } ?> diff --git a/include/log.php b/include/log.php index 9006187..4b64512 100644 --- a/include/log.php +++ b/include/log.php @@ -10,8 +10,10 @@ require_once 'fonctions.inc.php'; // $level => INFO, ALERT, ERROR function log_write($log, $level=INFO) { - global $table_prefix, $webmaster, $db; + global $table_prefix, $webmaster; // actual connected user or user 'script' + $db = new db(); + $user = (!empty( $_SERVER["PHP_AUTH_USER"])?$_SERVER["PHP_AUTH_USER"]:'Intruder?!'); //mail message @@ -54,6 +56,7 @@ function log_write($log, $level=INFO) { mail( $webmaster, "Erreur Site Web", $log_mail ); } + $db->close(); } // $w_db = true -> write log in database (default) diff --git a/vote.form.php b/vote.form.php index 7e2e397..45b6c5a 100644 --- a/vote.form.php +++ b/vote.form.php @@ -87,6 +87,7 @@ if ($dolibarr->result->num_rows == 0) print " Bonjour " . $votant['firstname'] . " " . $votant['lastname'] . ',' . EOLH . EOLH . "Le vote ne sera ouvert qu'à partir du " . formattedate('fr', $votation['td'] , "Europe/Paris") . " et jusqu'au " . formattedate('fr', $votation['df'] , "Europe/Paris") . '.' . EOLH . "Si vous pensez que ceci est une erreur, veuillez prendre contact avec les responsables de l'association."; } } + $db->close(); } print(' diff --git a/vote.resultat.php b/vote.resultat.php index bcff0dc..91d28a9 100644 --- a/vote.resultat.php +++ b/vote.resultat.php @@ -22,6 +22,7 @@ print ''; $db = new db(); + print('

@@ -29,7 +30,8 @@ print('

LISTE DES VOTATIONS

'); -if ( empty( $_GET["id"])) + + if ( empty( $_GET["id"])) { choixVotation('/vote.resultat.php'); }else @@ -38,6 +40,7 @@ if ( empty( $_GET["id"])) print('

VOTE

'); + $query = 'SELECT *, UNIX_TIMESTAMP(DATE_ADD(dateFin, INTERVAL 1 DAY)) as tf FROM liste_votations WHERE id=' . $db->protect($idVotation); $result = $db->query($query); $votation = $db->result->fetch_array(MYSQLI_ASSOC); @@ -111,6 +114,7 @@ if ( empty( $_GET["id"])) '); } +$db->close(); require_once 'footer.html'; ?>