File Manager V1.5
FILE_CONTENT: send_mail.php
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "info@ke-techno.com";
$email_subject = "Customer Inquairy ";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['subject']) ||
!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['phone']) ||
!isset($_POST['message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$subject = $_POST['subject']; // required
$last_name = $_POST['name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['phone']; // not required
$comments = $_POST['message']; // required
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Subject: ".clean_string($subject)."\n";
$email_message .= "Names: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Message: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
$phone_number = preg_replace('/^0/','256',$telephone);
$sms ="Thank you for contacting KE-Technologies. We will be in touch with you shortly. For more info call us on 0779400095 / 0759653156";
$data= array(
'method'=>'SendSms',
'userdata'=> array(
'username'=>'kedam_00',// Egosms Username
'password'=>'ken00095_00' //Egosms Password
),
'msgdata'=> array(
array(
'number'=>$phone_number,
'message'=>$sms,
'senderid'=>'KE-Technologies') ) );
//encode the array into json+
$json_builder =json_encode($data);
//use curl to post the the json encoded information
$ch = curl_init('http://www.egosms.co/api/v1/json/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_builder);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ch_result = curl_exec($ch);
curl_close($ch);
//print an array that is json decoded
// print_r(json_decode($ch_result,true));
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Thank you for contacting us. We will be in touch with you very soon. For more inquary call us on 0779400095 / 0759653156')
window.location.href='index.php';
</SCRIPT>");
}
?>
[ KEMBALI ]