Abmelden?
# Angabe mit http://
# Enter the page for confirmation that should be shown before unsubscribe will be executed
# Page MUST contain a form e.g.
# With http://
$UnsubscribeConfirmationPage="";
# Geben Sie die Seite zur Bestaetigung an, die NACH Absenden der Umfrage angezeigt werden soll
# Enter a page that will be shown after submitting unsubscription survey
$UnsubscriptionSurveyConfirmationPage="";
# Geben Sie mit Semikolon(;) getrennt die Gruende fuer die Abmeldung an
# Specify reasons for unsubscription delimited by semicolon(;)
$UnsubscriptionSurveyReasons="";
# Bei der Script-Generierung wird dieser Schluessel anhand des Datums/Uhrzeit erstellt,
# der Schluessel kann manuell geaendert werden, darf jedoch NIE leer sein.
# The key will be created with help of date/time of script creation. You can change the key
# but ist should never be empty.
$CryptKey="11/08/2416043131110485";
# Optional zur SICHEREREN Verschluessung der Daten beim Double-Opt-In kann eine Datei verwendet werden,
# die die Einmalschluessel mit E-Mail-Adresse und Verfallsdatum enthaelt.
# Der Dateiname der Datei sollte so gewaehlt werden, dass dieser SCHWER zu erraten ist.
# Die Rechte auf die Datei muessen auf Linux/Unix-Systemen auf 666 gesetzt werden, damit das Script problemlos
# lesen und schreiben kann.
# Optionaly for better encryption you can use a file to store one time keys.
# The filename of file must be very difficult to gues.
# On Linux/Unix OS you must create the file and set the rights to 666 to let the script read and write the file.
$CryptKeyFile="";
# Verfallsdatum der Eintraege in Tagen
# Expiration days
$CryptKeyExpiresInterval=30;
# Seite, die gezeigt wird, wenn der Key nicht gefunden wird, weil die Zeit $CryptKeyExpiresInterval abgelaufen ist oder
# doppelt geklickt wurde und damit die E-Mail-Adresse nicht mehr in der Datei steht.
# Page that should be showen when key was not found e.g. user makes a double click or entry is expired ($CryptKeyExpiresInterval)
$CryptKeyErrorPage="";
# Charset of Website, when you use utf-8 encoding than you must specify utf-8
$WebsiteContentCharset="iso-8859-1";
# anonymize saved ipv4 or ipv6 address
# 0 or not defined no anonymization
# 1 = ipv4: last octett will be filled with zero, ipv6: last segment/chunk will be filled with zero
# 2 = ipv4: 3th, 4th octett will be filled with zero, ipv6: 7th, 8th segment/chunk will be filled with zero
# 3 = ipv4: 2th, 3th, 4th octett will be filled with zero, ipv6: 6th, 7th, 8th segment/chunk will be filled with zero
# 4 = ipv4: 1th, 2th, 3th, 4th octett will be filled with zero, ipv6: 5th, 6th, 7th, 8th segment/chunk will be filled with zero
define("ip_address_mask_length", 0);
########### Ab hier nichts mehr aendern #####################
########### Don't change anything at this position #####################
$CRLF = "\r\n";
$DateTimeFormat = 'Y-m-d H:i:s';
# FALLS register_globals off
if (ini_get('register_globals') == 0) {
if ( isset($_GET['Action']) )
$Action=$_GET['Action'];
if ( isset($_GET['EMail']) )
$EMail=$_GET['EMail'];
if ( isset($_POST['EMail']) )
$EMail=$_POST['EMail'];
if ( isset($_GET['NewEMail']) )
$NewEMail=$_GET['NewEMail'];
if ( isset($_POST['NewEMail']) )
$NewEMail=$_POST['NewEMail'];
if ( isset($_POST['Action']) )
$Action=$_POST['Action'];
if ( isset($_GET['Format']) )
$Format=$_GET['Format'];
if ( isset($_POST['Format']) )
$Format=$_POST['Format'];
if ( isset($_POST['RG']) )
$RG=$_POST['RG'];
if ( isset($_GET['RG']) )
$RG=$_GET['RG'];
if ( isset($_GET['EMailb']) )
$EMail=base64_decode($_GET['EMailb']);
if ( isset($_POST['EMailb']) )
$EMail=base64_decode($_POST['EMailb']);
}
$AllowedActions = array("subscribe", "unsubscribe", "confirmation", "unsubscribe_confirm", "edit", "unsubscriptionsurvey");
if (!function_exists ('stripos') ) {
function stripos ( $haystack, $needle, $offset=NULL ) {
if (isset($offset) && $offset != NULL)
return strpos( strtolower($haystack), strtolower($needle), $offset);
else
return strpos(strtolower($haystack), strtolower($needle), $needle);
}
}
if (!function_exists ('str_ireplace') ) {
function str_ireplace($search,$replace,$subject){
$token = chr(1);
$haystack = strtolower($subject);
$needle = strtolower($search);
while (($pos=strpos($haystack,$needle))!==FALSE){
$subject = substr_replace($subject,$token,$pos,strlen($search));
$haystack = substr_replace($haystack,$token,$pos,strlen($search));
}
$subject = str_replace($token,$replace,$subject);
return $subject;
}
}
if(!function_exists("in_arrayi")){
function in_arrayi($needle, $haystack) {
return in_array(strtolower($needle), array_map('strtolower', $haystack));
}
}
# Helper
$Helper = new Helper;
$REMOTE_ADDR = $Helper->getOwnIP();
# Crypt
$crypt = new EncDec;
$crypt->hash = $CryptKey;
// List-Unsubscribe-Post header
if( isset($_GET["lup"]) && $_GET["lup"] == "lup" && isset($_SERVER['REQUEST_METHOD']) && strtoupper($_SERVER['REQUEST_METHOD']) == "POST" ){
if(!isset($_POST["List-Unsubscribe"])){
print "List-Unsubscribe POST value missing, see https://tools.ietf.org/html/rfc8058.";
exit;
}
if(isset($_POST["List-Unsubscribe"]) && $_POST["List-Unsubscribe"] != "One-Click"){
print "List-Unsubscribe POST value invalid, see https://tools.ietf.org/html/rfc8058.";
exit;
}
$UnsubscribeConfirmationPage="";
$UnsubscriptionSurveyReasons="";
}
if(isset($_GET["lup"]))
unset($_GET["lup"]);
if(isset($_POST["List-Unsubscribe"]))
unset($_POST["List-Unsubscribe"]);
// List-Unsubscribe-Post header /
if ( !isset($Action) || $Action == "" || !in_arrayi($Action, $AllowedActions) ) {
print "Es wurde das Feld Action nicht übermittelt! / Field Action was not submitted!";
exit;
}
if ( ($EMailText == "" || $EMailSubject == "") && $Action == "subscribe" ) {
print "Fehler es ist kein E-Mail-Text oder kein Betreff für die Bestätigungs-E-Mail vorhanden.";
exit;
}
if ( (isset($EMail)) && ($Action=="confirmation") ) {
if(isset($CryptKeyFile) && $CryptKeyFile != "") {
$crypt->hash = $crypt->GetCryptKey($CryptKeyFile, $EMail);
if(!$crypt->hash) {
if ($CryptKeyErrorPage != "")
header("Location: $CryptKeyErrorPage");
else
print "Die übergebene E-Mai-Adresse befindet sich nicht (mehr) zur Bestätigung im Verteiler.";
exit;
}
}
$EMail = $crypt->phpDecrypt($EMail);
}
if ( $Action != "unsubscriptionsurvey" && (!isset($EMail) || empty($EMail) || !$Helper->CheckEMail($EMail, $Action == "unsubscribe" || $Action == "unsubscribe_confirm" )) ) {
if ($ErrorPage != "")
header("Location: $ErrorPage");
else
print "Es wurde keine E-Mail-Adresse angegeben oder die E-Mail-Adresse liegt nicht im korrekten Format vor!";
exit;
}
if ($Action == "edit") {
if(!isset($NewEMail))
$NewEMail = $EMail; // alte E-Mail
else {
if ( ($NewEMail == "") || ( !$Helper->CheckEMail($NewEMail) ) ) {
if ($ErrorPage != "")
header("Location: $ErrorPage");
else
print "Die E-Mail-Adresse liegt nicht im korrekten Format vor!";
exit;
}
}
}
##################################### Spam test
if($Action != "unsubscriptionsurvey"){
$teststring="";
reset ($_GET);
foreach($_GET as $key => $val){
if(is_array($val))
$val = join(",", $val);
$teststring .= "$key=$val";
}
reset ($_POST);
foreach($_POST as $key => $val){
if(is_array($val))
$val = join(",", $val);
$teststring .= "$key=$val";
}
if ($Helper->CheckForSpam($teststring) == 1) {
print "Error processing form data";
exit;
}
}
#####################################
if ($Action == "unsubscribe" && !empty($UnsubscribeConfirmationPage)) {
$page = $Helper->LoadContentFromURL($UnsubscribeConfirmationPage);
if(!empty($page)){
$var = array_merge($_GET, $_POST);
$html = "";
$var["Action"] = "unsubscribe_confirm";
foreach($var as $key => $value) {
if ($key == "SubmitBtn") continue;
if(is_array($value))
$value = join(";", $value);
$html .= '';
$page = str_ireplace("[$key]", $value, $page);
}
$page = str_ireplace("", $html."", $page);
if (empty($SERVER_NAME)) {
$SERVER_NAME = $_SERVER['SERVER_NAME'];
}
if (empty($SCRIPT_NAME)) {
$SCRIPT_NAME = $_SERVER['SCRIPT_NAME'];
}
if(isset($_SERVER['HTTPS']))
$Script = "https://";
else
$Script = "http://";
$Script .= $SERVER_NAME.$SCRIPT_NAME;
$page = str_replace('action=""', 'action="'.$Script.'"', $page);
$Helper->SetHTMLHeaders($WebsiteContentCharset);
print $page;
exit;
}
}
if ($Action == "subscribe") {
$headers = "From: $Recipient".$CRLF;
$headers .= "Return-Path: <$Recipient>".$CRLF;
if (empty($SERVER_NAME)) {
$SERVER_NAME = $_SERVER['SERVER_NAME'];
}
if (empty($SCRIPT_NAME)) {
$SCRIPT_NAME = $_SERVER['SCRIPT_NAME'];
}
$message = $Helper->LoadContentFromURL($EMailText);
$isUTF8 = $Helper->IsUTF8String($message);
if(isset($CryptKeyFile) && $CryptKeyFile != "") {
if(!$crypt->AddNewCryptKey($CryptKeyFile, $EMail, $CryptKey))
exit;
}
if(isset($_SERVER['HTTPS']))
$Link = "https://";
else
$Link = "http://";
$Link .= $SERVER_NAME.$SCRIPT_NAME."?Action=confirmation&EMail=".urlencode($crypt->phpEncrypt($EMail));
#Fuer weitere Felder, diesen muessen im HTML-Formular und im SuperMailer angelegt werden!
$s="";
reset ($_GET);
foreach($_GET as $key => $val){
if(is_array($val))
$val = join(";", $val);
$message = str_ireplace ("[$key]", $val, $message);
if ($key == "EMail") continue;
if ($key == "Action") continue;
if ($key == "SubmitBtn") continue;
$pos = strpos ($key, "[]");
if ($pos !== false) {
$key = substr($key, 0, $pos - 1);
}
if (is_array($val)) { # RG as array?
if($s == "")
$s = "$key=".urlencode($crypt->phpEncrypt(join(";", $val)));
else
$s .= "&$key=".urlencode($crypt->phpEncrypt(join(";", $val)));
} else {
if($s == "")
$s = "$key=".urlencode($crypt->phpEncrypt($val));
else
$s .= "&$key=".urlencode($crypt->phpEncrypt($val));
}
}
reset ($_POST);
foreach($_POST as $key => $val){
if(is_array($val))
$val = join(";", $val);
$message = str_ireplace ("[$key]", $val, $message);
if ($key == "EMail") continue;
if ($key == "Action") continue;
if ($key == "SubmitBtn") continue;
$pos = strpos ($key, "[]");
if ($pos !== false) {
$key = substr($key, 0, $pos - 1);
}
if (is_array($val)) { # RG as array?
if($s == "")
$s = "$key=".urlencode($crypt->phpEncrypt(join(";", $val)));
else
$s .= "&$key=".urlencode($crypt->phpEncrypt(join(";", $val)));
} else {
if($s == "")
$s = "$key=".urlencode($crypt->phpEncrypt($val));
else
$s .= "&$key=".urlencode($crypt->phpEncrypt($val));
}
}
if($s != "")
$Link .= "&".$s;
if(!$isUTF8)
$headers .= "Content-Type: text/plain; charset=$WebsiteContentCharset".$CRLF;
else
$headers .= "Content-Type: text/plain; charset=utf-8".$CRLF;
$headers .= "Content-Transfer-Encoding: 8bit".$CRLF;
$message = str_replace ("[BESTAETIGUNGSLINK]", $Link, $message);
$message = str_replace ("[CONFIRMATIONLINK]", $Link, $message);
$old_track_errors = @ini_set('track_errors', 1);
if(!mail($EMail, $EMailSubject, $message, $headers)){
if(function_exists("error_get_last") && empty($php_errormsg)){
print "Can't send email, PHP mail() must be configured properly." . " Error: ";
print_r(error_get_last());
}
else
print "Can't send email, PHP mail() must be configured properly." . (isset($php_errormsg) ? " Error: " . $php_errormsg : "");
@ini_set('track_errors', $old_track_errors);
exit;
}
@ini_set('track_errors', $old_track_errors);
if ($ConfirmationMailSendOKPage != "")
header("Location: $ConfirmationMailSendOKPage");
else
print "Ihnen wurde eine E-Mail an die E-Mail-Adresse $EMail mit einem Bestätigungslink zur Aufnahme in unseren Newsletter gesendet.
Bitte klicken Sie in dieser E-Mail auf den Bestätigungslink, damit Ihre E-Mail-Adresse in unseren Newsletter aufgenommen wird.";
exit;
}
if($Action == "unsubscriptionsurvey"){
if(isset($_POST["Reason"])){
$headers = "From: $Recipient".$CRLF;
$headers .= "Return-Path: <$Recipient>".$CRLF;
$message="";
reset ($_GET);
foreach($_GET as $key => $val){
if ($key == "EMail") continue;
if ($key == "Action") continue;
if ($key == "SubmitBtn") continue;
if (is_array($val))
$message .= "$key: ".$Helper->RemoveCRLF(join(";", $val))."\n";
else
$message .= "$key: ".$Helper->RemoveCRLF($val, " ")."\n";
}
reset ($_POST);
foreach($_POST as $key => $val){
if ($key == "EMail") continue;
if ($key == "Action") continue;
if ($key == "SubmitBtn") continue;
if (is_array($val))
$message .= "$key: ".$Helper->RemoveCRLF(join(";", $val))."\n";
else
$message .= "$key: ".$Helper->RemoveCRLF($val, " ")."\n";
}
$message .= "IP: ".$REMOTE_ADDR."\n";
$message .= "DateTime: " . date($DateTimeFormat) . "\n";
$message .= "DatumZeit: " . date($DateTimeFormat) . "\n";
$headers .= "Content-Type: text/plain; charset=$WebsiteContentCharset".$CRLF;
$headers .= "Content-Transfer-Encoding: 8bit".$CRLF;
$old_track_errors = @ini_set('track_errors', 1);
if(!mail($Recipient, "unsubsurvey", $message, $headers)){
if(function_exists("error_get_last") && empty($php_errormsg)){
print "Can't send email(3), PHP mail() must be configured properly." . " Error: ";
print_r(error_get_last());
}
else
print "Can't send email(3), PHP mail() must be configured properly." . (isset($php_errormsg) ? " Error: " . $php_errormsg : "");
@ini_set('track_errors', $old_track_errors);
exit;
}
@ini_set('track_errors', $old_track_errors);
}
if ($UnsubscriptionSurveyConfirmationPage != "")
header("Location: $UnsubscriptionSurveyConfirmationPage");
else
print "Vielen Dank für die Teilnahme an unserer Umfrage.";
exit;
}
# Aufruf ueber Bestaetigungs-E-Mail
if ($Action=="confirmation") {
$Action="subscribe";
}
# Aufruf ueber Abmeldebestaetigungsseite
if ($Action=="unsubscribe_confirm") {
$Action="unsubscribe";
}
$headers = "From: $Recipient".$CRLF;
$headers .= "Return-Path: <$Recipient>".$CRLF;
$headers .= "Content-Type: text/plain; charset=$WebsiteContentCharset".$CRLF;
$headers .= "Content-Transfer-Encoding: 8bit".$CRLF;
# Alle uebergebenen Werte in die Nachricht uebernehmen
$message = "";
reset ($_GET);
foreach($_GET as $key => $val){
if ($key == "Action") continue;
if ($key == "SubmitBtn") continue;
if ($key == "EMail" && $Action == "unsubscribe") continue;
if(is_array($val))
$val = join(";", $val);
if ($Action == "subscribe")
$message .= "$key: ".$crypt->phpDecrypt($val)."\n";
else {
if (is_array($val)) # RG as array?
$message .= "$key: ".join(";", $val)."\n";
else
$message .= "$key: ".$val."\n";
}
}
reset ($_POST);
foreach($_POST as $key => $val){
if ($key == "Action") continue;
if ($key == "SubmitBtn") continue;
if ($key == "EMail" && $Action == "unsubscribe") continue;
if(is_array($val))
$val = join(";", $val);
if ($Action == "subscribe")
$message .= "$key: ".$crypt->phpDecrypt($val)."\n";
else {
if (is_array($val)) # RG as array?
$message .= "$key: ".join(";", $val)."\n";
else
$message .= "$key: ".$val."\n";
}
}
if($Action == "unsubscribe"){
$message .= "EMail: <%EMAIL_ADD%>\n";
$emails = explode( strpos($EMail, ",") !== false ? "," : ";", $EMail );
}else{
$emails = array($EMail);
}
$message .= "IP: ".$REMOTE_ADDR."\n";
$message .= "DateTime: " . date($DateTimeFormat) . "\n";
$message .= "DatumZeit: " . date($DateTimeFormat) . "\n";
# Versenden der Mail
$old_track_errors = @ini_set('track_errors', 1);
for($i=0; $i", $emails[$i], $message);
if(!mail($Recipient, $Action, $_message, $headers)) {
if(function_exists("error_get_last") && empty($php_errormsg)){
print "Can't send email(2), PHP mail() must be configured properly." . " Error: ";
print_r(error_get_last());
}
else
print "Can't send email(2), PHP mail() must be configured properly." . (isset($php_errormsg) ? " Error: " . $php_errormsg : "");
@ini_set('track_errors', $old_track_errors);
exit;
}
}
@ini_set('track_errors', $old_track_errors);
if ($Action == "edit")
if ($EditOKPage != "")
header("Location: $EditOKPage");
else
print "Vielen Dank für die Mitteilung der Änderungen!";
else
if ($Action == "subscribe")
if ($SubscribeOKPage != "")
header("Location: $SubscribeOKPage");
else
print "Ihre E-Mail-Adresse $EMail wurde zu unserer Newsletterliste hinzugefügt!";
else{
## fuer/for Magento Export Script
#$Helper->LoadContentFromURL("url to magentoexport.php and params");
if (empty($UnsubscribeOKPage)){
print "Ihre E-Mail-Adresse $EMail wurde aus unserer Newsletterliste entfernt!";
exit;
}
if(empty($UnsubscriptionSurveyReasons)){
header("Location: $UnsubscribeOKPage");
exit;
}
$page = $Helper->LoadContentFromURL($UnsubscribeOKPage);
if(empty($page) || stripos($page, "';
$page = str_ireplace("", $html."", $page);
$reasons = explode(";", $UnsubscriptionSurveyReasons);
$html = "";
for($i=0; $iIsUTF8String($reasons[$i]))
$reason = utf8_encode($reasons[$i]);
else
$reason = $reasons[$i];
}else
$reason = htmlentities($reasons[$i], ENT_COMPAT, $WebsiteContentCharset);
$html .= '
';
}
$temp = substr($page, 0, stripos($page, "