diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-06-30 10:43:53 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-06-30 10:43:53 +0200 |
commit | e247526ba388ce3def4f83ad8fb26852082bb7dd (patch) | |
tree | 335d0bd2797542462a3074e0c524a41a45e0257b /appli_3_alpha_old/sendmail.php | |
parent | 679551b7b545a72d376d9e60a8f3da66e44a6855 (diff) | |
download | 2007-AWOR-e247526ba388ce3def4f83ad8fb26852082bb7dd.tar.gz 2007-AWOR-e247526ba388ce3def4f83ad8fb26852082bb7dd.tar.bz2 2007-AWOR-e247526ba388ce3def4f83ad8fb26852082bb7dd.zip |
Version alpha_old3 2007-02-22+15:12:38 - 2007-02-27+20:02:20
Diffstat (limited to 'appli_3_alpha_old/sendmail.php')
-rw-r--r-- | appli_3_alpha_old/sendmail.php | 101 |
1 files changed, 78 insertions, 23 deletions
diff --git a/appli_3_alpha_old/sendmail.php b/appli_3_alpha_old/sendmail.php index e739884..631fa99 100644 --- a/appli_3_alpha_old/sendmail.php +++ b/appli_3_alpha_old/sendmail.php @@ -17,24 +17,74 @@ generate_html_divs_menu(); </p> </div> <?php generate_html_div_help(); -if( isset($_GET['envoi']) ) +if( isset($_POST['idR']) ) { - // TODO : code d'envoi - echo '<div id="contenu"><pre>'; - print_r($_REQUEST); - echo '</div></body></html>'; - exit(); + $idR=addslashes($_POST['idR']); } - -if( isset($_GET['idR']) ) +else { - $idR=addslashes($_GET['idR']); +?> + <div id="errmsg"> + Erreur lors de l'émission de l'email : Paramètre manquant ou érroné + </div></body></html> +<?php + exit(); } -else + +if( isset($_POST['envoi']) ) { - $errmsg=""; + include 'include/ludo/config.inc.php'; + + if ( !isset($_POST['msgObject']) || !isset($_POST['msgText']) || !is_array($_POST['dataParticipants']) ) + { + $errmsg = "Erreur lors de l'émission de l'email : Paramètre manquant ou érroné"; + } + else + { + if ( !isset($CONFIG['automatedMail']) ) + { + $errmsg = "Erreur lors de l'émission de l'email : Erreur de configuration par l'administrateur"; + } + else + { + // Potentiellement dangereux... + $query='SELECT nomP, prenomP, courrielP FROM Personne WHERE idP=\'' . implode("' OR idP='", $_POST['dataParticipants']) . "'"; + //~ echo " DEBUG : QUERY : $query\n"; + $result = mysql_query($query); + if ( ! $result ) + { + $errmsg = "Erreur lors de l'émission de l'email : Erreur de base de données"; + } + else + { + $to=array(); + while ( list($nomP, $prenomP, $courrielP) = mysql_fetch_row($result) ) + { + $to[]="$nomP $prenomP <$courrielP>"; + } + $to=implode(', ',$to); + + + if ( ! mail ( $to, $_POST['msgObject'], $_POST['msgText'], 'From: ' . $CONFIG['automatedMail'] . "\r\n" ) ) + { + $errmsg = "Erreur lors de l'émission de l'email : Erreur inconnue"; + } + } + } + } + + if ( isset($errmsg) ) + { + echo '<div id="errmsg">' . $errmsg .'</div></body></html>'; + } + else + { + echo '<div id="contenu">Le courriel à bien été envoyé</div></body></html>'; + } + exit(); } + $result = mysql_query("SELECT idL FROM Reunion WHERE idR='$idR'"); if (mysql_num_rows($result)===1) { @@ -46,16 +96,16 @@ else } -if ( isset($errmsg) ) + if ( isset($errmsg) ) { - echo '<div id="contenu">' . $errmsg .'</div></body></html>'; + echo '<div id="errmsg">' . $errmsg .'</div></body></html>'; exit(); } ?> <div id="contenu"> - <form id="formmail" action="sendmail.php" method="get" onsubmit="return dataListe('participants','dataParticipants');"> + <form id="formmail" action="sendmail.php" method="post" onsubmit="return dataListe('participants','dataParticipants');"> <table> <tbody> <tr> @@ -77,11 +127,12 @@ if ( isset($errmsg) ) { list($idP, $courrielP, $nomP, $prenomP) = mysql_fetch_array($result); $personnes[$idP]=array($courrielP, $nomP, $prenomP); - echo '<option value="'.$idP.'" onDblClick="addPers(this.form);">'; + echo '<option value="'.$idP.'" ondblclick="addPers(this.form);">'; echo $nomP . " " . $prenomP; echo "</option>\n"; } } + ?> </select> </td> @@ -96,9 +147,9 @@ if ( isset($errmsg) ) <?php foreach( $personnes as $idP=>$p) { - if ( isset($_GET['mail_idP' . $idP] ) ) + if ( isset($_POST['mail_idP' . $idP] ) ) { - echo '<option value="'.$idP.'" onDblClick="addPers(this.form);">'; + echo '<option value="'.$idP.'">'; echo $p[1] . " " . $p[2]; echo "</option>\n"; } @@ -110,24 +161,28 @@ if ( isset($errmsg) ) </tbody> </table> <div> - Modèle : + Modèle : <?php echo '<select name="modelsList" id="modelsList" onchange="loadlist(\'include/ludo/mail_textarea.php?idR='; - echo $idR . "&model=','modelsList','divMsg');\">\n"; + echo $idR . "&model=','modelsList','divMsg');\">\n"; ?> <option value="empty">Vierge</option> - <option value="cree">Nouvelle Réunion</option> - <option value="modif">Réunion modifiée</option> - <option value="annul">Réunion annulée</option> - <option value="fixee">Réunion fixée</option> + <option value="cree">Nouvelle Réunion</option> + <option value="modif">Réunion modifiée</option> + <option value="annul">Réunion annulée</option> + <option value="fixee">Réunion fixée</option> </select> </div> <div> Objet : <input name="msgObject" type="text" size="40" value="AWOR : Courriel de notification" /> + </div> <div id='divMsg'> <?php include 'include/ludo/mail_textarea.php'; ?> </div> <div> + <?php + echo '<input name="idR" type="hidden" value="' . $idR . '" />' . "\n"; + ?> <input name="envoi" type="hidden" value="1" /> <input type="submit" value="Envoyer" /> </div> |