ruạṛ
<?php //these calls will get repeated in template.php so use require_once $data_dir = $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/'; $template_dir = $_SERVER['DOCUMENT_ROOT'].'/resources/template/'; require_once $data_dir.'universal.php'; require_once $template_dir.'functions.php'; session_start(); $mailbody = $m = ''; $json = '{'; $from_email = ''; foreach($_POST as $f => $v) { if(strtolower($f) == 'security_code' || strtolower($f) == 'auth' || strtolower($f) == 'submit') { continue; } if(strpos(strtolower($f),'email')!==false) { if(is_email(trim($v))) { $from_email = trim($v); } } $mailbody .= "$f: $v \n"; $n = str_replace('-','_',$f); $x = str_replace('"',"'",trim($v));//double quotes break the javascript; $x = str_replace(array("\r\n","\n","\t"),'\n',$x); // line breaks break the javascript $json .= '"'.$n.'":"'.$x.'",'; } $json = rtrim($json,',').'}'; if(!isset($_SESSION['security_code']) || empty($_SESSION['security_code']) || !isset($_POST['auth']) || empty($_POST['auth']) || ($_SESSION['security_code'] != $_POST['auth'] ) ) { $m .= 'Incorrect security code, please try again.';//.$_SESSION['security_code'].' | '.$_POST['auth'];//debugging setcookie('formMessage', '<p>'.$m.'</p>', time()+30,'/'); setcookie('contactformJson',$json,time()+30,'/'); getout(''); exit; } if(!$from_email) //appropriate field doesn't exist or doesn't validate) { $from_email = SITE_FROM_ADDRESS; } $email_address = SITE_FROM_ADDRESS; //$email_address = 'matt@activatedesign.co.nz'; //testing //$email_address = 'programmer@activatedesign.co.nz'; //development $subject = 'Enquiry from '.SITE_FROM_NAME.' website'; $headers = "From: $from_email" . "\n" . "Reply-To: $from_email" . "\n" . "Return-Path: $from_email" . "\n" . 'X-Mailer: PHP/' . phpversion(); mail($email_address, $subject, $mailbody, $headers); //* default action $form = true; require_once($_SERVER['DOCUMENT_ROOT'].'/resources/template/template.php'); //*/ //header('Location: /Thank-You/'); //alternative ?>
cải xoăn