<?php
//==============================================================
// A71-MailingList By Alessandro Marinuzzi - [Alecos]
//==============================================================
// Version: 1.3 - Date: 10.05.2010 - Under GPL License
//==============================================================
// hide@address.com - http://www.alecos.it
//==============================================================
$pnameml = "newsletter"; // Put here the name of mailing-list
$request = "subscribe"; // Put here the comand of mailing-list
$pdomain = "domain.com"; // Put here the domain of mailing-list
//==============================================================
// Detecting language, messages and server O/S
//==============================================================
if (!defined('PHP_EOL')) {
if (strtoupper(substr(PHP_OS,0,3) == 'WIN')) {
define('PHP_EOL',"\r\n");
} elseif (strtoupper(substr(PHP_OS,0,3) == 'MAC')) {
define('PHP_EOL',"\r");
} elseif (strtoupper(substr(PHP_OS,0,3) == 'DAR')) {
define('PHP_EOL',"\n");
} else {
define('PHP_EOL',"\n");
}
}
$find = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$lang = substr($find,0,2);
if ($lang == "it") {
$title = "Inserisci la tua mail per iscriverti alla Mailing List";
$mesg1 = "Non sei ancora iscritto!";
$mesg2 = "Indirizzo e-mail errato!";
$mesg3 = "Iscrizione fallita!";
$mesg4 = "Iscrizione eseguita! Grazie!";
$label = "Tua E-Mail";
$buttn = "Iscriviti";
} else {
$title = "Insert your mail for subscribing to Mailing List";
$mesg1 = "You aren't subscribed yet!";
$mesg2 = "Wrong e-mail address!";
$mesg3 = "Subscription failed!";
$mesg4 = "Subscription performed! Thanks!";
$label = "Your E-Mail";
$buttn = "Subscribe";
}
//==============================================================
// Do not touch below
//==============================================================
if ((!isset($_POST['fmail'])) || (empty($_POST['fmail']))) {
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>[A71-MailingList]</title>
<link rel="stylesheet" type="text/css" media="all" href="a71ml/a71ml.css">
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<table class="custom" cellpadding="5" align="center">
<tr>
<td>
<p class="title">' . $title . '</p>
<p class="custom"><font color="#0066CC">' . $mesg1 . '</font></p>
<p class="custom"><label class="custom" for="fmail">' . $label . '</label>: <input class="custom" type="text" size="40" id="fmail" name="fmail" value="' . $_POST['fmail'] . '" /></p>
<p class="custom"><input class="button" style="cursor: pointer" type="submit" value="' . $buttn . '" /></p>
</td>
</tr>
</table>
</form>
</body>
</html>';
} elseif (!preg_match('/^[a-zA-Z0-9]+([_\\.-][a-zA-Z0-9]+)*'.'@([a-zA-Z0-9]+([\.-][a-zA-Z0-9]+))+$/', stripslashes($_POST['fmail']))) {
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>[A71-MailingList]</title>
<link rel="stylesheet" type="text/css" media="all" href="a71ml/a71ml.css">
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<table class="custom" cellpadding="5" align="center">
<tr>
<td>
<p class="title">' . $title . '</p>
<p class="custom"><font color="#CC0033">' . $mesg2 . '</font></p>
<p class="custom"><label class="custom" for="fmail">' . $label . '</label>: <input class="custom" type="text" size="40" id="fmail" name="fmail" value="' . $_POST['fmail'] . '" /></p>
<p class="custom"><input class="button" style="cursor: pointer" type="submit" value="' . $buttn . '" /></p>
</td>
</tr>
</table>
</form>
</body>
</html>';
} else {
$fmail = stripslashes($_POST['fmail']);
$subject = $request;
$message = $request;
$fsender = str_replace('@', '=', $fmail);
$myml = $pnameml . '-' . $request . '-' . $fsender . '@'. $pdomain;
$headers = "From: $fmail" . PHP_EOL . "Reply-To: $fmail" . PHP_EOL . "Return-Path: $fmail" . PHP_EOL . "MIME-Version: 1.0" . PHP_EOL . "Content-type: text/plain; charset=ISO-8859-1" . PHP_EOL . "Content-Transfer-Encoding: 8bit" . PHP_EOL . "X-Mailer: A71-MailingList 1.3";
if (!@mail($myml, $subject, $message, $headers)) {
if (!@mail($myml, $subject, $message, $headers, "-f $fmail")) {
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>[A71-MailingList]</title>
<link rel="stylesheet" type="text/css" media="all" href="a71ml/a71ml.css">
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<table class="custom" cellpadding="5" align="center">
<tr>
<td>
<p class="title">' . $title . '</p>
<p class="custom"><font color="#CC0033">' . $mesg3 . '</font></p>
<p class="custom"><label class="custom" for="fmail">' . $label . '</label>: <input class="custom" type="text" size="40" id="fmail" name="fmail" value="' . $_POST['fmail'] . '" /></p>
<p class="custom"><input class="button" style="cursor: pointer" type="submit" value="' . $buttn . '" /></p>
</td>
</tr>
</table>
</form>
</body>
</html>';
}
} else {
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>[A71-MailingList]</title>
<link rel="stylesheet" type="text/css" media="all" href="a71ml/a71ml.css">
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<table class="custom" cellpadding="5" align="center">
<tr>
<td>
<p class="title">' . $title . '</p>
<p class="custom"><font color="#33CC66">' . $mesg4 . '</font></p>
<p class="custom"><label class="custom" for="fmail">' . $label . '</label>: <input class="custom" type="text" size="40" id="fmail" name="fmail" value="' . $_POST['fmail'] . '" /></p>
<p class="custom"><input class="button" style="cursor: pointer" type="submit" value="' . $buttn . '" /></p>
</td>
</tr>
</table>
</form>
</body>
</html>';
}
}
exit();
?>