1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
| <?php
if((session_is_registered("valid_user")))
{
######################################################################################
// PARAMETRES D'ENVOIE
$delais=10;
$paquets=10;
######################################################################################
include("editeur/fckeditor.php") ;
if (isset($_POST['action']) && $_POST['action']=='Envoyer') {
if (isset($_POST['type_envoie']) && $_POST['type_envoie']=='solo') {
// ENVOIE INDIVIDUEL
if (verif_mail($_POST['email']) == 1 ) {
mysql_query("insert into newsletter (titre,destinataire,corps,date,heure,nb_envoie) values ('".$_POST['titre']."','".$_POST['email']."','".$_POST['corps']."','".date('Y-m-d')."','".date("H:i:s")."',1);");
//echo "insert into newsletter (titre,destinataire,corps,date,heure,nb_envoie) values ('".$_POST['titre']."','".$_POST['email']."','".$_POST['corps']."','".date('Y-m-d')."','".date("H:i:s")."'),'".$nb."');";
// RECUPERATION DE L'ID DE LA NEWSLETTER
$query="select * from newsletter order by id_news desc limit 0,1";
$p=mysql_query($query);
$t=@mysql_fetch_array($p);
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=admin.php?url=nl_action&action=solo&id_news=".$t['id_news']."'>";
}
else {
$alert='Veuillez saisir une adresse e-mail correct.';
$_POST['action'] = 1;
}
}
else {
if (isset($_POST['type_envoie']) && $_POST['type_envoie']=='tous') {
//ENVOIE GROUPE
$query="select * from newsletter_user where statut=1;";
$p=mysql_query($query);
$nb=@mysql_num_rows($p);
mysql_query("insert into newsletter (titre,destinataire,corps,date,heure,nb_envoie) values ('".$_POST['titre']."','Tous','".$_POST['corps']."','".date('Y-m-d')."','".date("H:i:s")."','".$nb."');");
// RECUPERATION DE L'ID DE LA NEWSLETTER
//echo 'test';
$query="select * from newsletter order by id_news desc limit 0,1";
$p=mysql_query($query);
$t=@mysql_fetch_array($p);
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=admin.php?url=nl_action&action=tous&id_news=".$t['id_news']."&limit1=0&limit2=".$paquets."'>";
}
else {
if (isset($_POST['type_envoie']) && $_POST['type_envoie']=='groupe') {
//ENVOIE GROUPE
echo 'test';
$query="select * from newsletter_usergr where id_ngr=".$_POST['id_ngr'].";";
$p=mysql_query($query);
$nb=@mysql_num_rows($p);
mysql_query("insert into newsletter (titre,destinataire,corps,date,heure,nb_envoie) values ('".$_POST['titre']."','Groupe','".$_POST['corps']."','".date('Y-m-d')."','".date("H:i:s")."','".$nb."');");
// RECUPERATION DE L'ID DE LA NEWSLETTER
//echo 'test';
$query="select * from newsletter order by id_news desc limit 0,1";
$p=mysql_query($query);
$t=@mysql_fetch_array($p);
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=admin.php?url=nl_action&id_ngr=".$id_ngr."&action=groupe&id_news=".$t['id_news']."&limit1=0&limit2=".$paquets."'>";
}
}
}
}
?>
<img src="img/kit_graph/kg06.jpg"><table cellpadding="0" cellspacing="1" border="0" width="100%">
<tr>
<td colspan="4" align="center"><img src="img/kit_graph/newsletter.gif" border="0"></td>
</tr>
</table>
<table cellpadding="1" cellspacing="0" border="0" width="95%" align="center">
<form action="admin.php?url=nl_envoie" method="post">
<tr>
<td class="content311" colspan="2"><b>Envoie d'une newsletter</b></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td class="content211" colspan="2">
<b>Attention :</b><br>
Le champ e-mail est à renseigner seulement si vous voulez envoyer votre newsletter à une personne précise.
</td>
</tr>
<?php
if (isset($alert)) {
?>
<tr>
<td height="5"></td>
</tr>
<tr>
<td class="content211" colspan="2"><b><?php echo $alert; ?></b></td>
</tr>
<?php
}
?>
<tr>
<TD height="5"></TD>
</tr>
<tr>
<td class="content111" width="">Titre : </td>
<td class="content111" width="400"><input type="text" name="titre" value="<?php echo $t['titre']; ?>" class="text" size="50"></td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td class="content111" colspan="2">Contenu :</td>
</tr>
<tr>
<td class="content111" colspan="2">
<?php
$oFCKeditor = new FCKeditor('corps') ;
$oFCKeditor->Width = '100%' ;
$oFCKeditor->Height = '500' ;
$oFCKeditor->ToolbarSet = 'Ludwig' ;
$oFCKeditor->BasePath = 'editeur/';
$oFCKeditor->Value = $t['corps'];
$oFCKeditor->Create() ;
?>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td class="content111"><input name="type_envoie" type="radio" value="tous"> Tous</td>
<td></td>
</tr>
<tr>
<td class="content111"><input name="type_envoie" type="radio" value="solo"> E-mail : </td>
<td class="content111"><input type="text" name="email" value="<?php echo $_GET['email']; ?>" class="text" size="30"></td>
</tr>
<tr>
<td class="content111"><input name="type_envoie" type="radio" value="groupe"> Groupe : </td>
<td class="content111">
<select name="id_ngr" size="1" class="file">
<?php
$query="select * from newsletter_groupe order by intitule;";
if($p=mysql_query($query,$bd)){
while($Tab=mysql_fetch_array($p)){
echo '<option';
if ($id_ngr==$Tab["id_ngr"]) echo " selected ";
echo ' value='.$Tab["id_ngr"].'>'.$Tab["intitule"].'</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td class="content111" colspan="2" align="center">
<input type="submit" name="action" value="Envoyer" class="submit">
</td>
</tr>
</form>
</table>
<?php
}
else
{
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=admin.php?url=index'>";//si condition pas respecté renvoie sur la page d'accueil
}
mysql_close($bd);
?> |
Partager