1
0

ajout fermeture de la database

This commit is contained in:
2022-09-19 12:04:33 +02:00
parent cf526f166c
commit cd91a95aea
5 changed files with 18 additions and 5 deletions

View File

@ -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();
}
?>

View File

@ -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)