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://www.gymnasium-luechow.de/newsletter/script/?Action=confirmation&EMail=".rawurlencode($crypt->phpEncrypt($EMail)); //da an dem bestätigungslink immer eine &id= mit rangehängt wird musste ich diese entfernen $Link = "http://www.gymnasium-luechow.de/index.php?id=".$TYPO3SCRIPTID."&Action=confirmation&EMail=".rawurlencode($crypt->phpEncrypt($EMail)); //$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-Mailif ($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 Mailif(!@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;}?>