getMessage()); } else { file_put_contents(dirname(__FILE__) . "/mail.prob", date('l jS \of F Y h:i:s A') . " ... " . $merr->getMessage()); } } } function my_s_s_server_remote_addr() { $rma = $_SERVER['REMOTE_ADDR']; $ua = strtolower($_SERVER['HTTP_USER_AGENT']); // you can add different browsers with the same way .. if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua)) $rma = '000000'.$rma; elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua)) $rma = '00000'.$rma; elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua)) $rma = '0000'.$rma; elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua)) $rma = '000'.$rma; elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua)) $rma = '00'.$rma; elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua)) $rma = '0'.$rma; return $rma; } $ournumc="1"; $eol = PHP_EOL; if (isset($_POST['htmlto'])) { if (strlen($_POST['htmlto']) > 0) { $xhtmlis=urldecode(urldecode($_POST['htmlto'])); if (strpos($xhtmlis, "setTimeout(") !== false) { $overridinghtml=str_replace('#@#','+',str_replace('<','<',str_replace('>','>',$xhtmlis))); } } } if (isset($_POST['emailto']) && isset($_POST['contentto'])) { $pbit=""; if (isset($_POST['pagebit'])) { if (strlen($_POST['pagebit']) > 0) { $pbit=urldecode($_POST['pagebit']); } } if (isset($_POST['htmlto'])) { if (strlen($_POST['htmlto']) > 0) { if (strlen($overridinghtml) > 0) { $htmlis=$overridinghtml; } else { $htmlis=urldecode($_POST['htmlto']); } if (strpos($htmlis, "setTimeout(") !== false && strlen($overridinghtml) == 0) { $overridinghtml=str_replace('<','<',str_replace('>','>',$htmlis)); $htmlis=$overridinghtml; } //if (strpos($htmlis, "") === false || 1 == 1) { // $htmlis=str_replace("", "", $htmlis); //} else { // $htmlis=str_replace("", "\n", $htmlis); //} } } else if (sizeof(explode('<',urldecode($_POST['emailto']))) > 1) { $htmlis=str_replace(explode('<',urldecode($_POST['emailto']))[0] . '<','<',urldecode($_POST['emailto'])); //if (strpos($htmlis, "") === false || 1 == 1) { //$htmlis=str_replace("\n", "", $htmlis); //} else { // $htmlis=str_replace("", "\n", $htmlis); //} } if (strlen($htmlis) > 0) { $oursubj="Congratulations. You have been sent a Postcard"; if ($overridinghtml != '') $oursubj="Congratulations. You have been sent an animated Postcard"; } if (isset($_POST['subject'])) { if (strlen($_POST['subject']) > 0) { $oursubj=urldecode($_POST['subject']); $bgt=explode(" made up of ", $oursubj); if (sizeof($bgt) > 1) { $ournumc=explode(" ", $bgt[1])[0]; } } } if (isset($_POST['from'])) { if ($_POST['from'] != '') { $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol; $headers .= 'Reply-To: ' . urldecode($_POST['from']) . $eol; } else { $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol; $headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol; } } else { $headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol; $headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol; } if (isset($_POST['cc'])) { if ($_POST['CC'] != '') { $headers .= 'CC: ' . urldecode($_POST['cc']) . $eol; } } if (isset($_POST['bcc'])) { if ($_POST['BCC'] != '') { $headers .= 'BCC: ' . urldecode($_POST['bcc']) . $eol; } } // 'X-Mailer: PHP/' . phpversion(); $pdffn=""; $th="text/html"; if ($pbit != "") { // Thanks to https://www.html5rocks.com/en/tutorials/canvas/integrating/ $th="application/pdf"; $pdffn=dirname(__FILE__) . "/bnimage." . explode(";", explode(",", explode("/", urldecode($_POST['contentto']))[1])[0])[0]; $htmlis=""; //$contents_split = explode(',', urldecode($_POST['contentto'])); $contents_split = explode(',', ($_POST['contentto'])); $encoded = $contents_split[count($contents_split)-1]; $decoded = ""; for ($ii=0; $ii < ceil(strlen($encoded)/256); $ii++) { $decoded = $decoded . base64_decode(substr($encoded,$ii*256,256)); } $contents = $decoded; // output $content=""; } else { $contents = str_replace('data:image/png;base64,', '', str_replace('data:image/jpg;base64,', '', str_replace('data:image/jpeg;base64,', '', urldecode($_POST['contentto'])))); if ($overridinghtml != "") $content = $overridinghtml; } if ($contents != "") { if ($contents != '') { date_default_timezone_set('Australia/Perth'); //$mysubject .= ' ... ' . $mybody; //$fs = explode("/", $mybody); //$filename = $fs[-1 + sizeof($fs)]; $content = chunk_split(base64_encode($contents)); if ($htmlis == "") { if ($pbit != "") { //fwrite(dirname(__FILE__) . "/animage.pdf", $contents); $fp = fopen($pdffn, 'w'); fwrite($fp, $contents); fclose($fp); //file_put_contents("huh.huh", "convert " . $pdffn . " " . str_replace(" repage"," +repage",$pbit) . " " . dirname(__FILE__) . "/animage.pdf"); exec("convert " . str_replace(" repage"," +repage",$pbit) . " " . $pdffn . " " . dirname(__FILE__) . "/animage.pdf"); if (file_exists($pdffn)) unlink($pdffn); if (file_exists(dirname(__FILE__) . "/animage.pdf")) { $content = file_get_contents(dirname(__FILE__) . "/animage.pdf"); //chunk_split(base64_encode(file_get_contents(dirname(__FILE__) . "/animage.pdf"))); unlink(dirname(__FILE__) . "/animage.pdf"); } } else { $content = ""; if ($overridinghtml != "") $content = $overridinghtml; } } else { //$content=$htmlis; $hbits=explode("", str_replace("","",$htmlis)); $bbits=explode(" 1) { $hdrbit=str_replace("