Willkommen im neuen Forum von concrete5.de.
Die Anmeldung ist ab dem 15.10.2020 nur noch mit E-Mail Adresse und Passwort möglich. Eine Anmeldung mit Benutzername ist nicht mehr möglich.

Diese Nachricht löschen.
Anhang entfernen?
Zurück zur Themenliste
W
web089 0.png 20.12.2013 17:22

Newslettertool "Supermailer" in C5 einbinden (php-Script - wohin?)

Hat jemmand Erfahrung mit der Einbindung in C5 mit Newslttertool Supermailer.de? Hier muss ein php-Script aufgerufen werden, dass die An- u. Abmeldung steuert. Ich habe das Tool öfter bei html-Seiten eingesetzt. Nun ist mir nicht klar wo ich diese newsletter.php im Verzeichnis zur Ausführung bringe. Anmerkung: Meine PHP-Kenntnisse sind nahezu nicht vorhanden. hier der script-code <?php ############################################################################# # SUPERMAILER SUBSCRIBE/UNSUBSCRIBE SCRIPT # # Double-Opt-In # # Copyright © 2001 - 2009 Mirko Boeer # # http://www.supermailer.de/ # # # # Dieses Script kann kostenlos eingesetzt werden, jedoch muss dieser Header # # im Script enthalten bleiben! # # This script can be used for free. The header must be contained in script! # # # # Systemvoraussetzungen: PHP 4 und Windows/Unix # # 14.04.2009 # ############################################################################# error_reporting(0); # Geben Sie die E-Mail-Adresse Ihres POP3/IMAP Postfachs an # Enter the email address of your POP3/IMAP inbox $Recipient="newsletter@domain-name.de"; # Geben Sie die Seite an, die angezeigt werden soll, wenn eine ANmeldung erfolgte # und an den neuen Abonnenten die E-Mail zur Bestätigung gesendet wurde # Angabe mit http:// # Enter the page that should be shown if a recipient wants to subscribe to your recipients list # and the confirmation is be sent. # With http:// $ConfirmationMailSendOKPage="http://www.gdomain-name.de/newsletter/newsletteranmeldung.php"; # Geben Sie die Seite an, die angezeigt werden soll, wenn eine ANmeldung erfolgte # Angabe mit http:// # Enter the page that should be shown if a recipient will bei added to your recipients list # With http:// $SubscribeOKPage="http://www.domain-name.de/newsletter/newsletteranmeldungabgeschlossen.php"; # Geben Sie die Seite an, die angezeigt werden soll, wenn eine ABmeldung erfolgte # Angabe mit http:// # Enter the page that should be shown of a recipients will be removed from you recipients list # With http:// $UnsubscribeOKPage="http://www.domain-name.de/newsletter/newsletterabmeldung.php"; # Geben Sie die Seite an, die angezeigt werden soll, wenn die E-Mail-Adresse aeusserlich nicht korrekt ist = Fehlerseite # Angabe mit http:// # Enter the page that should be shown if an error ocurrs = email address not correct # With http:// $ErrorPage="http://www.domain-name.de/newsletter/newsletterfehler.php"; # Geben Sie die Seite an, die angezeigt werden soll, wenn die Änderung der Daten ausgeführt worden ist # Angabe mit http:// # Enter the page that should be shown if the user has edited the informations # With http:// $EditOKPage=""; # Geben Sie den Betreff der Bestaetigungs-E-Mail an # Enter the subject of confirmation email $EMailSubject="Ihre Anmeldung zu unserem Newsletter"; # Geben Sie die Datei mit dem Text für die Bestaetigungs-E-Mail an, die der neue Abonnent # geschickt bekommt. Dies muss eine Textdatei sein, kein HTML! # Beachten Sie, der E-Mail-Text muss den Platzhalter [BESTAETIGUNGSLINK] enthalten, damit der # Abonnent in der E-Mail auch den Link für die Aufnahme in den Newsletter anklicken kann. # Angabe mit http:// # Specify a plain text file that should be send as confirmation email. The text must contain # the text [CONFIRMATIONLINK]. The text will be replaced with the cofirmation link. # With http:// $EMailText="http://www.domain-name.de/newsletter/newsletter.txt"; # 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="yxyxyxyxxyxyxxyyxxxdomain-name"; # 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=""; ########### Ab hier nichts mehr aendern ##################### ########### Don't change anything at this position ##################### $CRLF = "\r\n"; # 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($REMOTE_ADDR)) || ($REMOTE_ADDR == "") ) $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; } function CheckEMail($email) { if (strpos($email, "@") === False) return 0; $s = substr($email, strpos($email, "@"), strlen($email)); if (count(explode(".", $s)) < 2) return 0; if (!(strpos($email, "\n") === False)) return 0; if (!(strpos($email, "\r") === False)) return 0; if (!(strpos($email, ",") === False)) return 0; if (!(strpos($email, ";") === False)) return 0; if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)){ return 1; }else { return 0; } } function CheckForSpam($str) { if ( eregi("from:",$str) || eregi("to:",$str) || eregi("multipart",$str) || eregi("cc:",$str) || eregi("bcc:",$str) ) return 1; return 0; } # Crypt $crypt = &new EncDec; $crypt->hash = $CryptKey; if ( (!isset($Action)) || ($Action == "") ) { print "Es wurde das Feld Action nicht übermittelt!"; exit; } if (($EMailText == "") || ($EMailSubject == "")) { 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 = GetCryptKey($CryptKeyFile, $EMail); if(!$crypt->hash) { if ($CryptKeyErrorPage != "") header("Location: $CryptKeyErrorPage"); else print "Die uebergebene E-Mai-Adresse befindet sich nicht (mehr) zur Bestätigung im Verteiler."; exit; } } $EMail = $crypt->phpDecrypt(rawurldecode($EMail)); } if ( (!isset($EMail)) || ($EMail == "") || ( !CheckEMail($EMail) ) ) { 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 == "") || ( !CheckEMail($NewEMail) ) ) { if ($ErrorPage != "") header("Location: $ErrorPage"); else print "Die E-Mail-Adresse liegt nicht im korrekten Format vor!"; exit; } } } ##################################### Spam test $teststring=""; reset ($_GET); while (list ($key, $val) = each ($_GET)) { $teststring .= "$key=$val"; } reset ($_POST); while (list ($key, $val) = each ($_POST)) { $teststring .= "$key=$val"; } if (CheckForSpam($teststring) == 1) { print "Error processing form data"; exit; } ##################################### if ($Action == "subscribe") { $headers = "From: $Recipient".$CRLF; $headers .= "Return-Path: <$Recipient>".$CRLF; if ($SERVER_NAME == "") { $SERVER_NAME = $_SERVER['SERVER_NAME']; } if ($SCRIPT_NAME == "") { $SCRIPT_NAME = $_SERVER['SCRIPT_NAME']; } $message = join("", file($EMailText)); if($message == "") { $s = substr (strrchr ($EMailText, "/"), 1); $message = join("", file($s)); } if(isset($CryptKeyFile) && $CryptKeyFile != "") { if(!AddNewCryptKey($CryptKeyFile, $EMail, $CryptKey)) exit; } $Link = "http://".$SERVER_NAME.$SCRIPT_NAME."?Action=confirmation&EMail=".rawurlencode($crypt->phpEncrypt($EMail)); #Fuer weitere Felder, diesen muessen im HTML-Formular und im SuperMailer angelegt werden! $s=""; reset ($_GET); while (list ($key, $val) = each ($_GET)) { 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=".rawurlencode($crypt->phpEncrypt(join(";", $val))); else $s .= "&$key=".rawurlencode($crypt->phpEncrypt(join(";", $val))); } else { if($s == "") $s = "$key=".rawurlencode($crypt->phpEncrypt($val)); else $s .= "&$key=".rawurlencode($crypt->phpEncrypt($val)); } } reset ($_POST); while (list ($key, $val) = each ($_POST)) { 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=".rawurlencode($crypt->phpEncrypt(join(";", $val))); else $s .= "&$key=".rawurlencode($crypt->phpEncrypt(join(";", $val))); } else { if($s == "") $s = "$key=".rawurlencode($crypt->phpEncrypt($val)); else $s .= "&$key=".rawurlencode($crypt->phpEncrypt($val)); } } if($s != "") $Link .= "&".$s; $message = str_replace ("[BESTAETIGUNGSLINK]", $Link, $message); $message = str_replace ("[CONFIRMATIONLINK]", $Link, $message); if(!@mail($EMail, $EMailSubject, $message, $headers)) print "Can't send email."; 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; } # Aufruf ueber Bestaetigungs-E-Mail if ($Action=="confirmation") { $Action="subscribe"; } $headers = "From: $EMail".$CRLF; $headers .= "Return-Path: <$EMail>".$CRLF; # Alle uebergebenen Werte in die Nachricht uebernehmen $message = ""; reset ($_GET); while (list ($key, $val) = each ($_GET)) { if ($key == "Action") continue; if ($key == "SubmitBtn") continue; if ($Action == "subscribe") $message .= "$key: ".$crypt->phpDecrypt(rawurldecode($val))."\n"; else { if (is_array($val)) # RG as array? $message .= "$key: ".join(";", $val)."\n"; else $message .= "$key: ".rawurldecode($val)."\n"; } } reset ($_POST); while (list ($key, $val) = each ($_POST)) { if ($key == "Action") continue; if ($key == "SubmitBtn") continue; if ($Action == "subscribe") $message .= "$key: ".$crypt->phpDecrypt(rawurldecode($val))."\n"; else { if (is_array($val)) # RG as array? $message .= "$key: ".join(";", $val)."\n"; else $message .= "$key: ".rawurldecode($val)."\n"; } } $message .= "IP: ".$REMOTE_ADDR."\n"; $message .= "DateTime: ".strftime("%x %X")."\n"; # Versenden der Mail if(!@mail($Recipient, $Action, $message, $headers)) print "Can't send email {2}."; 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 if ($UnsubscribeOKPage != "") header("Location: $UnsubscribeOKPage"); else print "Ihre E-Mail-Adresse $EMail wurde aus unserer Newsletterliste entfernt!"; // ################################################################################## class EncDec{ var $hash; function hexToInt($s, $i) { (int)$j = $i * 2; (string)$s1 = $s; (string)$c = substr($s1, $j, 1); // get the char at position $j, length 1 (string)$c1 = substr($s1, $j+1, 1); // get the char at postion $j + 1, length 1 (int)$k = 0; switch ($c) { case "A": $k += 160; break; case "B": $k += 176; break; case "C": $k += 192; break; case "D": $k += 208; break; case "E": $k += 224; break; case "F": $k += 240; break; case " ": $k += 0; break; default: (int)$k = $k + (16 * (int)$c); break; } switch ($c1) { case "A": $k += 10; break; case "B": $k += 11; break; case "C": $k += 12; break; case "D": $k += 13; break; case "E": $k += 14; break; case "F": $k += 15; break; case " ": $k += 0; break; default: $k += (int)$c1; break; } return $k; } function hexToIntArray($s) { (string)$s1 = $s; (int)$i = strlen($s1); (int)$j = $i / 2; for($l = 0; $l < $j; $l++) { (int)$k = $this->hexToInt($s1,$l); $ai[$l] = $k; } return $ai; } function charToInt($c) { $ac[0] = $c; return $ac; } function xorString($ai) { $s = $this->hash; // (int)$i = strlen($s); $ai1 = $ai; (int)$j = count($ai1); for($i = 0; $i < $j; $i = strlen($s)) $s = $s.$s; for($k = 0; $k < $j; $k++) { (string)$c = substr($s,$k,1); $ac[$k] = chr($ai1[$k] ^ ord($c)); } (string)$s1 = implode('', $ac); return $s1; } function phpDecrypt($s) { { $ai = $this->hexToIntArray($s); (string)$s1 = $this->xorString($ai); return $s1; } } function intToHex($i) { (int)$j = (int)$i / 16; if ((int)$j == 0) { (string)$s = " "; } else { (string)$s = strtoupper(dechex($j)); } (int)$k = (int)$i - (int)$j * 16; (string)$s = $s.strtoupper(dechex($k)); return $s; } function xorCharString($s) { $ac = preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY); (string)$s1 = $this->hash; (int)$i = strlen($s1); (int)$j = count($ac); for($i=0; $i < $j; $i = strlen($s1)) { $s1 = $s1.$s1; } for($k = 0; $k < $j; $k++) { $c = substr($s1,$k,1); $ai[$k] = ord($c) ^ ord($ac[$k]); } return $ai; } function phpEncrypt($s) { $ai = $this->xorCharString($s); $s1 = ""; for($i = 0; $i < count($ai); $i++) $s1 = $s1.$this->intToHex((int)$ai[$i]); return $s1; } } function GetCryptKey($CryptKeyFile, $EncryptedEMail) { global $CryptKey, $CryptKeyExpiresInterval; if($CryptKeyFile == "") return $CryptKey; $fp = fopen($CryptKeyFile, "r"); if(!$fp) return ""; $contents = ""; while (!feof($fp)) { $buffer = fgets($fp, 4096); $contents .= $buffer; } $a = split("\n", $contents); $key = ""; $expiredItems = false; for($i=count($a) - 1; $i>=0; $i--) { if(trim($a[$i]) == "") { continue; } $b = split("\|", $a[$i]); if(count($b) < 3) { unset($a[$i]); $expiredItems = true; continue; } if($b[0] == $EncryptedEMail) { $key = $b[1]; unset($a[$i]); $expiredItems = true; continue; } if( time() >= $b[2] + ($CryptKeyExpiresInterval * 24 * 60 * 60) ) { unset($a[$i]); $expiredItems = true; } } fclose($fp); if($expiredItems) { $fp = fopen($CryptKeyFile, "w"); if($fp) { fwrite($fp, join("\n", $a)); fclose($fp); } } return $key; } function AddNewCryptKey($CryptKeyFile, $EMail, &$CryptKey) { global $crypt; $fp = fopen($CryptKeyFile, "a"); if(!$fp) { print "Kann in Datei $CryptKeyFile nicht schreiben.
Can't write to file $CryptKeyFile."; return false; } srand ((double)microtime()*1000000); $CryptKey = strftime(rand()."%D%H%I%j%m%M%p%S%u"); $CryptKey = str_replace("|", "-", $CryptKey); $CryptKey = str_replace("\n", "-", $CryptKey); $crypt->hash = $CryptKey; flock($fp, LOCK_EX); fwrite($fp, rawurlencode($crypt->phpEncrypt($EMail))."|".$CryptKey."|".time()."\n"); fclose($fp); return true; } ?> und hier die Zeilen die das Script bei An- und Abmeldung aufrufen: <!--Newsletteranmeldung beginnt hier--> Newsletter An-/Abmeldung

E-Mail-Adresse:

Name:


Sie möchten sich für unseren Newsletter

anmelden

abmelden

<!--Newsletteranmeldung endet hier-->
R
Remo 0.png 21.12.2013 12:23
Wie gerade per E-Mail beschrieben wäre es wohl am Besten ein "richtiges" concrete5 Add-on zu bauen. Dazu sind natürlich einige PHP Kentnisse erforderlich. Eine fertige Supermailer Integration wäre mir nicht bekannt..
S
Sarah 0.png 25.10.2014 12:16
Hallo web089, hast Du das Problem mirt einfügen gelöst. Möchte den supermailer auch einbinden, wuie geht das genau und wo? Vielen Dank. Sarali
W
web089 0.png 26.10.2014 13:53
Hallo Sarali, im Grunde ist die Lösung rechgt einfach. Wenn du mit dem Supermailer und deren Bedingungen vertraut bist (ggfs. schon mal in einer Website integriert hast), dann dürfte das keine Problem sein. 1. Du legst in C5 die erforderlichen Seiten an (siehe den beigefügten Screenshot) 2. Trage die Url-Pfade in die newsletter.php ein. (Bitte beachte die Gültigkeit deines $CryptKey) 3. Lade deine newsletter.php in das Verzeichnis /packeges/theme_name/themes/theme_name (Pfad sollte so bei dir aussehen) das wars schon. Viel Erfolg
S
Sarah 0.png 29.10.2014 08:21
Hallo web089, herzlichen Dank für die schnelle Hilfe. Ich arbeite dran und hoffe, ich bekomme das hin. Gebe Rückmeldung wenn es klappt. Grüße Sarali

Nachricht hinzufügen