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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
| <?
/* Configuration de la connexion BD */
include("../config.php");
$db = mysql_connect ($host, $user, $pass);
mysql_select_db ($base,$db);
// Formulaires
function Return_POST($val)
{
$val = trim($val);
$val = strip_tags($val);
$val = str_replace('"','"',$val);
return stripslashes($val);
}
// BBcode
function bbcode($string)
{
//[center][/center]
$string = preg_replace("!\[center\](.*?)\[/center\]!si","<center>\\1</center>",$string);
//[img][/img]
$string = preg_replace("!\[img\](.*?)\[/img\]!si","<img style=\"border: none\" src=\"\\1\">",$string);
//[url=""][/url]
$string = preg_replace("!\[url=(.*?)\](.*?)\[/url\]!","<a href=\"\\1\" class=\"liens\" target=\"_blank\">\\2</a>",$string);
//[url][/url]
$string = preg_replace("!\[url](.*?)\[/url\]!","<a href=\"\\1\" class=\"liens\" target=\"_blank\">\\1</a>",$string);
//[i][/i]
$string = preg_replace("!\[i\](.*?)\[/i\]!si","<i>\\1</i>",$string);
//[u][/u]
$string = preg_replace("!\[u\](.*?)\[/u\]!si","<span style=\"text-decoration: underline\">\\1</span>",$string);
//[b][/b]
$string = preg_replace("!\[b\](.*?)\[/b\]!si","<b>\\1</b>",$string);
return ($string);
}
if (isset($_GET["send"]))
{
//$contenu_message = bbcode(nl2br(htmlentities(addslashes(Return_POST($_POST["mail"])))));
//mail
$reply = "derniere_bataille@hotmail.fr";
$titre = Return_POST($_POST["titre"]);
$message = "<html>
<style>
.tab{
padding-top: 25px;
padding-right: 35px;
padding-bottom: 25px;
padding-left: 35px;
font-family: Verdana;
font-size: 11px;
border: 1px solid #51260B;
}
a.liens{
color: #0066FF;
}
a.liens:hover{
color: #003399;
text-decoration: underline;
}
</style>
<body>
<table width=70% border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td class=tab><p>".bbcode(nl2br(Return_POST($_POST["mail"])))."</p><p align=right>Cordialement, <br>Les Webmasters</p>
<p align=center><a href=http://www.derniere-bataille.net/><img src=http://www.derniere-bataille.net/img-design/game.jpg border=0></a></p></td>
</tr>
</table>
</body>
</html>";
$entete = "From: $reply\nContent-type:text/html\n";
$sql = mysql_query("SELECT mail FROM mailing_list") or die(mysql_error());
if (mysql_num_rows($sql)!=0)
{
echo $message;
while(list($email) = mysql_fetch_array($sql))
{
mail($email, $titre, $message, $entete);
echo("Mail envoyé à $email<br>");
}
}
}
?>
<html>
<head>
<title>Mailling List</title>
<style>
.txt {
font-family: Arial;
font-size: 12px;
}
</style>
</head>
<body>
<script>
//bbcode
function insertion(repdeb, repfin) {
var input = document.forms['formulaire'].elements['mail'];
input.focus();
/* pour l'Explorer Internet */
if(typeof document.selection != 'undefined') {
/* Insertion du code de formatage */
var range = document.selection.createRange();
var insText = range.text;
range.text = repdeb + insText + repfin;
/* Ajustement de la position du curseur */
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -repfin.length);
} else {
range.moveStart('character', repdeb.length + insText.length + repfin.length);
}
range.select();
}
/* pour navigateurs plus récents basés sur Gecko*/
else if(typeof input.selectionStart != 'undefined')
{
/* Insertion du code de formatage */
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + repdeb + insText + repfin + input.value.substr(end);
/* Ajustement de la position du curseur */
var pos;
if (insText.length == 0) {
pos = start + repdeb.length;
} else {
pos = start + repdeb.length + insText.length + repfin.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
/* pour les autres navigateurs */
else
{
/* requête de la position d'insertion */
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while(!re.test(pos)) {
pos = prompt("Insertion à la position (0.." + input.value.length + "):", "0");
}
if(pos > input.value.length) {
pos = input.value.length;
}
/* Insertion du code de formatage */
var insText = prompt("Veuillez entrer le texte à formater:");
input.value = input.value.substr(0, pos) + repdeb + insText + repfin + input.value.substr(pos);
}
}
</script>
<form action="index.php?send=ok" method="post" name="formulaire">
<input type="hidden" name="action" value="send">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="txt">
<tr>
<td height="30">Titre :</td>
<td><input name="titre" type="text" value="<?php if(isset($_POST["titre"])) echo($_POST["titre"]); ?>" size="45"></td>
</tr>
<tr>
<td valign="top"></td>
<td height="35"> <input type="button" value="centré" onClick="insertion('[center]', '[/center]')">
<input type="button" value="url" onClick="insertion('[url]', '[/url]')">
<input type="button" value="img" onClick="insertion('[img]', '[/img]')">
<input type="button" value="i" style="font-style: italic" onClick="insertion('[i]', '[/i]')">
<input type="button" value="u" style="text-decoration: underline" onClick="insertion('[u]', '[/u]')">
<input type="button" value="b" style="font-weight: bold" onClick="insertion('[b]', '[/b]')">
</td>
</tr>
<tr>
<td valign="top">Mail :</td>
<td><textarea name="mail" cols="45" rows="8"><?php if(isset($_POST["mail"])) echo($_POST["mail"]); ?></textarea></td>
</tr>
<tr>
<td colspan="2"> <p></p>
<center>
<input type="submit" value="Envoyer">
</center></td>
</tr>
</table>
</form>
</body>
</html> |
Partager