if (isset($_POST['submit'])) { function captcha_validation($num1, $num2, $total) { global $error; //Captcha check - $num1 + $num = $total if (intval($num1) + intval($num2) == intval($total)) { $error = "null"; } else { $error = "Captcha value is wrong.<br>"; } return $error; } $n1 = $_POST['num1']; $n2 = $_POST['num2']; $capta = $_POST['captcha']; $err = captcha_validation($n1, $n2, $capta); if ($err == "null") { // great success! /* These are the variable that tell the subject of the email and where the email will be sent.*/ $emailSubject = mysql_real_escape_string($_POST['subject']); $mailto = '*****@*****.**'; /* These will gather what the user has typed into the fieled. */ $nameField = mysql_real_escape_string($_POST['fullname']); $emailField = mysql_real_escape_string($_POST['email']); $message = mysql_real_escape_string($_POST['message']); $phoneField = mysql_real_escape_string($_POST['phone']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $country = mysql_real_escape_string($_POST['country']); /* This takes the information and lines it up the way you want it to be sent in the email. */ $body = <<<EOD
<?php require_once '../../../wp-load.php'; require ABSPATH . WPINC . '/pluggable.php'; global $krypton_config; $targetemail = $krypton_config['dt-contact-form-email']; $default = array('inputFullname' => '', 'inputEmail' => '', 'inputPhone' => '', 'inputMessage' => '', 'num1' => '', 'num2' => '', 'captcha' => ''); $args = wp_parse_args($_POST, $default); $total = $args['captcha']; $name = $args['inputFullname']; $email = $args['inputEmail']; $phone = $args['inputPhone']; $message = $args['inputMessage']; $captcha_error = captcha_validation($args['num1'], $args['num2'], $total); if (is_null($captcha_error)) { $fullmessage = __('Name : ', 'Krypton') . $name . '<br />' . __('Email : ', 'Krypton') . $email . '<br />' . __('Phone : ', 'Krypton') . $phone . '<br />' . __('Message : ', 'Krypton') . $message . '<br />'; $headers = 'MIME-Version: 1.0' . '\\r\\n'; $headers .= 'Content-type: text/html; charset=iso-8859-1' . '\\r\\n'; if (function_exists('wp_mail')) { add_filter('wp_mail_content_type', 'set_html_content_type'); wp_mail($targetemail, __("Contact from ", 'Krypton') . $name, $fullmessage); } else { mail($targetemail, __("Contact from ", 'Krypton') . $name, $fullmessage); } } function captcha_validation($num1, $num2, $total) { global $error; //Captcha check - $num1 + $num = $total if (intval($num1) + intval($num2) == intval($total)) { $error = null;
function contact_action_callback() { global $krypton_config; $targetemail = $krypton_config['dt-contact-form-email']; $default = array('inputFullname' => '', 'inputEmail' => '', 'inputPhone' => '', 'inputMessage' => '', 'num1' => '', 'num2' => '', 'captcha' => ''); //$args=wp_parse_args($_POST,$default); $total = $_POST['captcha']; $name = $_POST['inputFullname']; $email = $_POST['inputEmail']; $phone = $_POST['inputPhone']; $message = $_POST['inputMessage']; $captcha_error = captcha_validation($_POST['num1'], $_POST['num2'], $total); if (is_null($captcha_error)) { $fullmessage = __('Name : ', 'Krypton') . $name . '<br />' . __('Email : ', 'Krypton') . $email . '<br />' . __('Phone : ', 'Krypton') . $phone . '<br />' . __('Message : ', 'Krypton') . $message . '<br />'; $headers = 'MIME-Version: 1.0' . '\\r\\n'; $headers .= 'Content-type: text/html; charset=iso-8859-1' . '\\r\\n'; if (function_exists('wp_mail')) { add_filter('wp_mail_content_type', 'set_html_content_type'); wp_mail($targetemail, __("Contact from ", 'Krypton') . $name, $fullmessage); } else { mail($targetemail, __("Contact from ", 'Krypton') . $name, $fullmessage); } } }