3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Erstellt für 01art Webdesign * Datei: mail.php * Beschreibung: E-Mail-Klasse * * Autor: Ernesto Giménez <e@01art.de> * Contributors: * Datum: 28.03.13 12:42 * Letzte Änderung: 02.05.2013 */ class eMail { private $filterdomain, $name, $text, $recipient; public function __construct() { $this->custom_input = ""; } public function setDomain($domain) { $this->filterdomain = $domain; } public function setName($name) { $this->name = $this->spamproof($name); $this->name = $this->charakterproof($this->name); } public function setSiteName($sitename) { $this->sitename = addslashes($sitename); } public function setText($text) { $this->text = $this->spamproof($text); } public function setKopf($kopf) { $this->kopf = $kopf; } public function setRecipient($recipient) { $this->recipient = $this->spamproof($recipient); } public function setRedirect($redirect) { $this->redirect = $redirect; } public function ehost() { return gethostbyaddr($_SERVER["REMOTE_ADDR"]); } public function evaluate($email) { if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { return "nonvalid-email"; } $email = $this->charakterproof($email); return $this->spamproof($email); } public function recode_charset($string,$cs_from,$cs_to) { // Umcodierung $trans_tbl["ASCII"] = array("&", "¡", "€", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "é", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"); $trans_tbl["UNICODE"] = array("&#x26;", "&#161;", "&#8364;", "&#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;", "&#188;", "&#189;", "&#190;", "&#191;", "&#192;", "&#193;", "&#194;", "&#195;", "&#196;", "&#197;", "&#198;", "&#199;", "&#200;", "&#201;", "&#202;", "&#203;", "&#204;", "&#205;", "&#206;", "&#207;", "&#208;", "&#209;", "&#210;", "&#211;", "&#212;", "&#213;", "&#214;", "&#215;", "&#216;", "&#217;", "&#218;", "&#219;", "&#220;", "&#221;", "&#222;", "&#223;", "&#224;", "&#225;", "&#226;", "&#227;", "&#228;", "&#229;", "&#230;", "&#231;", "&#232;", "&#233;", "&#234;", "&#235;", "&#236;", "&#237;", "&#238;", "&#239;", "&#240;", "&#241;", "&#242;", "&#243;", "&#244;", "&#245;", "&#246;", "&#247;", "&#248;", "&#249;", "&#250;", "&#251;", "&#252;", "&#253;", "&#254;", "&#255;"); $trans_tbl["HTML"] = array("&amp;", "&iexcl;", "&euro;", "&cent;", "&pound;", "&curren;", "&yen;", "&brvbar;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&shy;", "&reg;", "&macr;", "&deg;", "&plusmn;", "&sup2;", "&sup3;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&sup1;", "&ordm;", "&raquo;", "&frac14;", "&frac12;", "&frac34;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&ETH;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&times;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&Yacute;", "&THORN;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;"); return str_replace($trans_tbl[$cs_from], $trans_tbl[$cs_to], $string); } public function define_sonderzeichen() { $sonderzeichen=array( "ö" => "ö", "ü" => "ü", "ß" => "ß","ä" => "ä", "Ä" => "Ä", "Ãœ" => "Ü", "Ö" => "Ö", "é" => "é", "è" => "é", "ê" => "ê", "á" => "á", "²" => "²", "°" => "°", "ñ" => "ñ", "Ã'" => "Ñ", "à " => "à", "ô" => "ô", "€" => "€", "'" => "\"", "„" => "\"", "‘" => "\"", "’" => "'", "Â" => " "); return $sonderzeichen; } private function spamproof($objekt) { // old proof /* if ((preg_match("/@".$this->filterdomain."/i", $email)) || (preg_match("/@aol.com/i", $this->name)) || (preg_match("/@/i", $this->name)) || (preg_match("/url=http/i", $this->text)) || (preg_match("/Content-Type:/i", $this->text)) || (preg_match("/bcc:/i", $email)) || (preg_match("/Content-Type:/i", $this->text)) || (preg_match("/bcc:/i", $this->text)) ) { header ("Location: http://".$this->filterdomain."/"); exit(); } return $email; */ if ( preg_match("/(to:|cc:|bcc:|from:|subject:|reply-to:|content-type:|MIME-Version:|multipart\/mixed|Content-Transfer-Encoding:)/ims", $objekt)) { header("Location: http://".$this->filterdomain."/"); exit(); } return $objekt; } private function charakterproof($objekt) { if (preg_match("/%0A|%0D|%00|\\0|%09|%01|%02|%03|%04|%05|%06|%07|%08|%09|%0B|%0C|%0E|%0F|%10|%11|%12|%13/i", $objekt)) { header("Location: http://".$this->filterdomain."/"); exit(); } return $objekt; } public function edate() { $hourdiff = "0"; // hours difference between server time and local time $timeadjust = ($hourdiff * 60 * 60); return date("d F Y, G:i:s",time() + $timeadjust); } private function eheader($email) { $header = "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/plain; charset=UTF-8\r\n"; $header .= "Content-Transfer-Encoding: 8bit\r\n"; $header .= "From: \"$this->name\"<$email>\r\n"; //$header .= "bcc: $recipient\r\n"; $header .= "Return-path: $this->recipient\r\n"; $header .= "X-Mailer: 01art Webdesign Internet-Mailer \r\n"; return $header; } private function email_send_template($email) { mail( $this->recipient, $this->sitename." E-Mail-Form", email_content($email). //"=======================================================\n". $this->kopf . //"\n=======================================================\n" . PHP_EOL . //"Date of entry : " . $this->edate() . " o'clock \nMr/Mrs " . $this->name . //" has given the following information: " . PHP_EOL . //"\n____________________________________________________________\n\n" . PHP_EOL . //"CONTACT\n" . PHP_EOL . //"Name: " . $this->name . //"\nEmail: ". $email . $this->custom_input . //"\n____________________________________________________________\n\n" . PHP_EOL . //"Message: \n" . $this->text . //"\n____________________________________________________________\n" . PHP_EOL . //"____________________________________________________________\n" . PHP_EOL . //"Browser and operating system of the sender : " . $_SERVER['HTTP_USER_AGENT'] . //"\nIP of the sender : ".$_SERVER['REMOTE_ADDR']." \nRemote Host of the sender : " . $this->ehost(), $this->eheader($email) ); return; } private static function email_content($email){ $mainContent = "=======================================================\n".$this->kopf. "\n=======================================================\n" . PHP_EOL . "Date of entry : " . $this->edate() . " o'clock \nMr/Mrs " . $this->name . " has given the following information: " . PHP_EOL . "\n____________________________________________________________\n\n" . PHP_EOL . "CONTACT\n" . PHP_EOL . "Name: " . $this->name . "\nEmail: ". $email . $this->custom_input . "\n____________________________________________________________\n\n" . PHP_EOL . "Message: \n" . $this->text . "\n____________________________________________________________\n" . PHP_EOL . "____________________________________________________________\n" . PHP_EOL . "Browser and operating system of the sender : " . $_SERVER['HTTP_USER_AGENT'] . "\nIP of the sender : ".$_SERVER['REMOTE_ADDR']." \nRemote Host of the sender : " . ";" echo $this->mainContent; } public static function fillContent(){ return $mainContent; } public function send_mail($from) { if (isset($from)) { $email = $this->evaluate($from); } if (isset($this->name, $email) && ($email != "nonvalid-email") ){ $this->email_send_template($email); header("Location: ".$this->redirect); } else {exit(); } } }
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /in/nUOWN on line 194
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_ECHO in /in/nUOWN on line 194
Process exited with code 255.

preferences:
174.13 ms | 1386 KiB | 64 Q