ajout fermeture de la database
This commit is contained in:
parent
cf526f166c
commit
cd91a95aea
@ -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");
|
||||
|
@ -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
|
||||
<input type="submit" value="Envoyer"/>
|
||||
</div>
|
||||
</form>';
|
||||
$db->close;
|
||||
}
|
||||
|
||||
function votationForm($path, $titre="", $libelle="", $dateDebut="", $DateFin="", $status=0)
|
||||
@ -133,6 +135,7 @@ function votesForm($path, $libelle = "", $method = 0)
|
||||
print('<input type="submit" formaction="index.php" value="' . _("Annuler") . '"/>') . EOL;
|
||||
print('<input type="submit" value="' . _("Envoyer") . '"/>') . EOL;
|
||||
print('</form>') . 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 . '<div id="listeVotants' . $idVote . '" style="display: none; line-height: 0.8;">' . $text . '</div>');
|
||||
print('<button id="button' . $idVote . '" onclick="show(\'listeVotants\',\'' . $idVote . '\')">Voir la liste des votants</button>' . EOLH);
|
||||
$db->close();
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -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)
|
||||
|
@ -87,6 +87,7 @@ if ($dolibarr->result->num_rows == 0)
|
||||
print " Bonjour " . $votant['firstname'] . " " . $votant['lastname'] . ',</h4>' . 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.</h4>";
|
||||
}
|
||||
}
|
||||
$db->close();
|
||||
}
|
||||
print(' </div>
|
||||
</div>
|
||||
|
@ -22,6 +22,7 @@ print '<script type="text/javascript">
|
||||
</script>';
|
||||
|
||||
$db = new db();
|
||||
|
||||
print(' <br><br>
|
||||
<!-- lalis Grid Section -->
|
||||
|
||||
@ -29,7 +30,8 @@ print(' <br><br>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center"><h3>LISTE DES VOTATIONS</h3>');
|
||||
if ( empty( $_GET["id"]))
|
||||
|
||||
if ( empty( $_GET["id"]))
|
||||
{
|
||||
choixVotation('/vote.resultat.php');
|
||||
}else
|
||||
@ -38,6 +40,7 @@ if ( empty( $_GET["id"]))
|
||||
print('
|
||||
<h3>VOTE</h3>
|
||||
<h4>');
|
||||
|
||||
$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"]))
|
||||
</section>');
|
||||
|
||||
}
|
||||
$db->close();
|
||||
|
||||
require_once 'footer.html';
|
||||
?>
|
||||
|
Reference in New Issue
Block a user