| 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/survey_demo/ |
Upload File : |
<?php
require_once('webadmin/basic_info.php');
if (!isset($_SESSION["id"]) || (int)$_SESSION["id"] <= 0) {
echo "<script type='text/javascript'>alert('Cannot find survey information.'); location.href=document.referrer; </script>";
exit;
}
$id = (int)$_SESSION["id"];
$campaign = get_campaign($id);
check_campaign_date($campaign);
//loop question
$message = "";
if ($campaign["user_login"] == "NOT_REQUEST_LOGIN") {
if (empty($_POST["user_name"])) {
$message .= "Please enter your name. \\n請輸入姓名。\\n\\n";
}
if (empty($_POST["telephone"])) {
$message .= "Please enter mobile number. \\n請輸入流動電話。\\n\\n";
} else {
if (!is_numeric($_POST["telephone"]) || (int)$_POST["telephone"] <= 0) {
$message .= "Mobile number should be a digital number. \\n流動電話必須由數字組成。\\n\\n";
}
}
if (empty($_POST["email"])) {
$message .= "Please enter email. \\n請輸入電郵地址。\\n\\n";
} else {
if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
$message .= "Email format is not correct. \\n請輸入正確的電郵地址。\\n\\n";
}
}
} else if ($campaign["user_login"] == "REQUEST_LOGIN") {
if (empty($_POST["telephone"])) {
$message .= "Please enter mobile number. \\n請輸入流動電話。\\n\\n";
} else {
if (!is_numeric($_POST["telephone"]) || (int)$_POST["telephone"] <= 0) {
$message .= "Mobile number should be a digital number. \\n流動電話必須由數字組成。\\n\\n";
}
}
if (empty($_POST["password"])) {
$message .= "Please enter password. \\n請輸入密碼。\\n\\n";
}
}
if (!isset($_POST["tnc"])) {
$message .= "Please read and agree the terms & conditions. \\n請細閱及同意條款及細則。\\n\\n";
}
if (!empty($message)) {
echo "<script type='text/javascript'>alert('" . $message . "'); location.href=history.back(); </script>";
exit;
}
//insert user info
if ($campaign["user_login"] == "NOT_REQUEST_LOGIN") {
$sql = "select * from user_info where tel = ? or email = ?";
$parameters = array(aes_crypt($_POST["telephone"], 1), aes_crypt($_POST["email"], 1));
$result = bind_pdo($sql, $parameters, "selectone");
if(!empty($result)){
echo "<script type='text/javascript'>alert('You have completed our survey before. Thanks you very much.\\n你之前已完成問卷。多謝參與'); location.href='campaign.php?id=" . $id . "'</script>";
exit;
}
$sql = "insert into user_info (user_name, tel, email, facebook_name, session_id, createdate, campaign_id) values (?,?,?,?,?,?,?)";
$parameters = array($_POST["user_name"], aes_crypt($_POST["telephone"], 1), aes_crypt($_POST["email"], 1), $_POST["facebook_name"], session_id(), $nowdate, $id);
bind_pdo($sql, $parameters);
$user_info_id = $dbh->lastInsertId();
//update question owner
$sql = "update answer set user_info_id = ?, temp = ? where session_id = ? and temp = ?";
$parameters = array($user_info_id, 0, session_id(), 1);
bind_pdo($sql, $parameters);
$_SESSION["completed_survey"] = 1;
} else if ($campaign["user_login"] == "REQUEST_LOGIN") {
//call api to check member info
/*$url = $site_info["api_url"] . "validate_vip";
$postData = array("telephone" => $_POST["telephone"], "password" => md5($_POST["password"]));
$result = call_curl($url, $postData, 1);
if (!empty($result)) {
//valid vip
$vip_code = $result;
check_user_has_fill_form($id, $vip_code);
//update question owner
$sql = "update answer set vip_code = ?, temp = ? where session_id = ? and temp = ?";
$parameters = array($vip_code, 0, session_id(), 1);
//bind_pdo($sql, $parameters);
//add points to vip code
$points = $campaign["get_points"];
} else {
$vip_code = "";
echo "<script type='text/javascript'>alert('Login fail. Please check your mobile number or password.\\n登入失敗。請檢查你輸入的電話號碼和密碼。');history.back();</script>";
exit;
}*/
}
/*header("Location: thankyou.php");
exit;*/
require_once("inc/class.phpmailer.php");
//send password to member
$email_to_customer_subject = $site_info{"companyname_en"} . " - Complete " . $campaign["name_en"] . " Survey";
//email content to customer
ob_start();
?>
<html>
<head>
<META name=GENERATOR content="MSHTML 8.00.6001.19394">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="font-family:arial,helvetica,sans-serif;color:#000;background:#fff;">
Dear <?=$_POST["name"]?>,<br><br>
<?php
foreach ($arraylangcode as $langcode => $langname) {
if (!empty($campaign["desc4_" . $langcode])) {
echo $campaign["desc4_" . $langcode] . "<br><br>";
}
}
?>
<?= $site_info{"companyname_en"} ?><br>
<a href='<?= $site_info{"url"} ?>' target='_blank'><?= $site_info{"url"} ?></a>
</body>
</html>
<?php
$email_customer_body = ob_get_contents();
ob_end_clean();
$enquiryemail = $site_info{"enquiryemail"};
$company_name = $site_info{"companyname_en"};;
//for customer
$x_mail = new PHPMailer();
$x_mail->IsSMTP(); // Set mailer to use SMTP
$x_mail->Host = 'smtp.sendgrid.net'; // Specify main and backup server
$x_mail->Port = 587; // Set the SMTP port
$x_mail->SMTPAuth = true; // Enable SMTP authentication
$x_mail->Username = 'garricklam1'; // SMTP username
$x_mail->Password = 'garrick1'; // SMTP password
$x_mail->SMTPSecure = 'tls';
/*$x_mail->IsSMTP();
$x_mail->Host = "localhost";
$x_mail->SMTPAuth = true;*/
$x_mail->CharSet = "UTF-8";
$x_mail->Sender = $enquiryemail;
$x_mail->AddReplyTo($enquiryemail, $company_name);
$x_mail->From = $enquiryemail;
$x_mail->FromName = $company_name;
//send to user not send to client
$x_mail->AddAddress($_POST["email"], $_POST["name"]);
$x_mail->AddBCC("kelvinchan@onesolution.com.hk", $company_name);
$x_mail->WordWrap = 50;
$x_mail->IsHTML(true);
$x_mail->Subject = $email_to_customer_subject;
$x_mail->Body = $email_customer_body;
if ($x_mail->Send()) {
echo "<script type='text/javascript'>alert('We have sent a email to you. Please check your email account.\\n 我們已發出電郵到你的電郵地址。請到你的電郵地址戶口檢查郵件。');top.location.href='thankyou.php';</script>";
exit;
} else {
echo "<script type='text/javascript'>alert('Email cannot send out. Please contact us for further details.\\n電郵未能發送到你的電郵地址,請與我們聯絡。');top.location.href='thankyou.php';</script>";
exit;
}
//header("Location: ".$site_info{"url"});