| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/alliancealliance/ |
Upload File : |
<?php
require_once ('webadmin/basic_info.php');
require_once('inc/class.phpmailer.php');
$ara = explode("|", $_SESSION['vCode']);
$verification = $_POST['verification'];
if ($ara[0] == $verification) {
$_SESSION['vCode'] = "";
$message = "";
if(empty($_POST["enquiry_for"])){
$message .= "Please select an enquiry issue.\\n\\n";
}
if(empty($_POST["name"])){
$message .= "Please enter your name.\\n\\n";
}
if(empty($_POST["tel"])){
$message .= "Please enter your teletel.\\n\\n";
}else{
if(!is_numeric($_POST["tel"])){
$message .= "Teletel should be digital format.\\n\\n";
}
}
if(empty($_POST["email"])){
$message .= "Please enter your email.\\n\\n";
}else{
if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
$message .= "Invalid email format.\\n\\n";
}
}
if(empty($_POST["content"])){
$message .= "Please enter message.\\n\\n";
}
/*if (empty($_POST["g-recaptcha-response"])) {
$message .= "Please click the verification box.\\n\\n";
}else{
$url = "https://www.google.com/recaptcha/api/siteverify";
$post_data = array("secret" => $google_recaptcha_secret_key, "response" => $_POST["g-recaptcha-response"]);
$result = call_curl($url, $post_data, 1);
$result_array = json_decode($result, true);
if(!$result_array["success"]){
$message .= "Cannot pass form checking.\\n\\n";
}
}*/
if(!empty($message)){
echo "<script>alert('".$message."'); history.back();</script>";
exit;
}
//send email
$email_subject = "Online Enquiry";
$email_body = '<html>
<head>
<META name=GENERATOR content="MSHTML 8.00.6001.19394">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
table td{
padding: 5px;
}
</style>
</head>
<body style="font-family:arial,helvetica,sans-serif !important;color:#000;background:#fff; width: 500px;">
Dear Administrator,<br><br>
The following information is an online enquiry.<br><br>
<table style="width: 100%; border-collapse: collapse;">
<tr>
<td style="width: 120px;">
Enquiry For:
</td>
<td>
'.$_POST["enquiry_for"].'
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
'.$_POST["name"].'
</td>
</tr>
<tr>
<td>
Tel.:
</td>
<td>
'.$_POST["tel"].'
</td>
</tr>
<tr>
<td>
E-mail:
</td>
<td>
'.$_POST["email"].'
</td>
</tr>
<tr>
<td style="vertical-align: top;">
Message:
</td>
<td>
'.nl2br($_POST["content"]).'
</td>
</tr>
</table>';
$email_body .= '<br><br><br>' . $site_info{"companyname_en"} . '<br> <a href="' . $site_info{"url"} . '" target="_blank">' . $site_info{"url"} . '</a></body></html>';
/*var_dump($email_body);
exit;*/
$sender_email = $site_info["enquiryemail"];
$company_name = $site_info["companyname_" . $langcode];
//for customer
$x_mail = new PHPMailer();
$x_mail->IsSMTP();
$x_mail->Host = 'smtp.mandrillapp.com'; // Specify main and backup server
$x_mail->Port = 587; // Set the SMTP port
$x_mail->SMTPAuth = true; // Enable SMTP authentication
$x_mail->Username = 'garricklam@onesolution.com.hk'; // SMTP username
$x_mail->Password = 'lYtE-w6jVOD4vZQrurvraQ'; // SMTP password
$x_mail->SMTPSecure = 'tls';
$x_mail->CharSet = "UTF-8";
$x_mail->Sender = $sender_email;
$x_mail->AddReplyTo($sender_email, $company_name);
$x_mail->From = $sender_email;
$x_mail->FromName = $company_name;
//send to user not send to client
$x_mail->AddAddress($site_info["enquiryemail"], $site_info["companyname_".$langcode]);
$x_mail->WordWrap = 50;
$x_mail->IsHTML(true);
$x_mail->Subject = $email_subject;
$x_mail->Body = $email_body;
if ($x_mail->Send()) {
$sent_email = 1;
//echo "<script>alert('電郵已成功送出。'); history.back();</script>";
} else {
$sent_email = 0;
//echo "<script>alert('電郵未能成功送出。'); history.back();</script>";
}
//insert data
$sql = "insert into enquiry set enquiry_for=?, name=?, tel=?, email=?, content=?, createdate=?";
$parameters = array($_POST["enquiry_for"], rsa_crypt($_POST["name"],1), rsa_crypt($_POST["tel"],1), rsa_crypt($_POST["email"],1), rsa_crypt($_POST["content"],1), date("Y-m-d"));
bind_pdo($sql, $parameters);
header("Location: contact_us_success.php");
}else{
echo "<script type='text/javascript'>
alert('Please enter correct verification code.');
history.back();
</script>";
exit;
}