| 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["course_category_id"]) || (int)($_POST["course_category_id"]) < 0) {
$message .= "Please select a course name.\\n\\n";
}
if (empty($_POST["course_id"]) || (int)($_POST["course_id"]) < 0) {
$message .= "Please select a course code.\\n\\n";
}else{
$course = get_course((int)$_POST["course_id"]);
if ($course["valid_apply"] == 1) {
if(!check_course_valid_apply((int)$_POST["course_id"])){
echo "<script>alert('This course is closed.'); location.href='index.php';</script>";
exit;
}
} else {
echo "<script>alert('This course is ".$course["stop_applying_text_".$langcode].".'); location.href='index.php';</script>";
exit;
}
}
if (empty($_POST["title"])) {
$message .= "Please select your title.\\n\\n";
}
if (empty($_POST["participant_name"])) {
$message .= "Please enter your name.\\n\\n";
}
if (empty($_POST["identity_id"])) {
$message .= "Please enter your HKID/Passport No.\\n\\n";
}
if (empty($_POST["company_name"])) {
$message .= "Please enter your company name.\\n\\n";
}
if (empty($_POST["company_address"])) {
$message .= "Please enter your company address.\\n\\n";
}
if (empty($_POST["position"])) {
$message .= "Please enter your position.\\n\\n";
}
if (empty($_POST["tel"])) {
$message .= "Please enter your telephone.\\n\\n";
} else {
if (!is_numeric($_POST["tel"])) {
$message .= "Invalid telephone format\\n\\n";
}
}
if (empty($_POST["mobile"])) {
$message .= "Please enter your mobile number.\\n\\n";
} else {
if (!is_numeric($_POST["mobile"])) {
$message .= "Invalid mobile number 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["cc_email"]) && !filter_var($_POST["cc_email"], FILTER_VALIDATE_EMAIL)) {
$message .= "Invalid cc email format\\n\\n";
}
if (!empty($_POST["fax"]) && !is_numeric($_POST["fax"])) {
$message .= "Invalid fax number format\\n\\n";
}
if (empty($_POST["exp_air_cargo"])) {
$message .= "Please select your experience in air cargo industry.\\n\\n";
}
if (empty($_POST["education_level"])) {
$message .= "Please select your education level.\\n\\n";
}
if (!empty($_POST["date_obtain_pre_cert"]) && !validateDate($_POST["date_obtain_pre_cert"], "Y-m-d")) {
$message .= "Please enter correct date of obtain previous certificate.\\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";
}
}*/
$sql = "select * from course where id = ?";
$parameters = array((int)$_POST["course_id"]);
$course_info = bind_pdo($sql, $parameters, "selectone");
if ($course_info["valid_apply"] != 1) {
$message .= "This course does not allow to apply. Please ask our staff for further details\\n\\n";
}
if (!empty($message)) {
echo "<script>alert('" . $message . "'); history.back();</script>";
exit;
}
$ref_code = get_ref_code();
//insert record into enrollment
if (isset($_POST["ra_code"])) {
$sql = "select * from ra_code where deleted = ? and code = ?";
$parameters = array(0, $_POST["ra_code"]);
$ra_code_info = bind_pdo($sql, $parameters, "selectone");
if ($ra_code_info["company_name_" . $langcode] != $_POST["company_name"]) {
$company_name_diff = 1;
} else {
$company_name_diff = 0;
}
$company_address_diff = 0;
/*if ($ra_code_info["company_address_" . $langcode] != $_POST["company_address"]) {
$company_address_diff = 1;
} else {
$company_address_diff = 0;
}*/
}
//get course category name and course name
$sql = "select * from course_category where id = ?";
$parameters = array((int)$_POST["course_category_id"]);
$course_category_info = bind_pdo($sql, $parameters, "selectone");
//send email
$email_subject = "Online Course Enrollment";
$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: 800px;">
Dear Customer,<br><br>
The following information is your enrollment record.<br><br>
<table style="width: 100%; border-collapse: collapse;">
<tr>
<td colspan="3">
<b>Enrollment Date: ' . date("Y-m-d") . '</b>
</td>
</tr>
<tr>
<td colspan="3">
<b>Reference Code: ' . $ref_code . '</b>
</td>
</tr>
<tr>
<td colspan="3">
<br>
<b>INFORMATION OF COURSE</b>
</td>
</tr>
<tr>
<td colspan="3">
Course Name:<br>
' . $course_category_info["name_" . $langcode] . '
</td>
</tr>
<tr>
<td colspan="3">
Course Code:<br>
' . $course_info["code"] . '
</td>
</tr>
<tr>
<td colspan="3">
<br>
<b>INFORMATION OF PARTICIPANT</b>
</td>
</tr>
<tr>
<td>
Title:<br>
' . $_POST["title"] . '
</td>
<td>
Name of Participant:<br>
' . $_POST["participant_name"] . '
</td>
<td>
HKID/Passport No.:<br>
' . $_POST["identity_id"] . '
</td>
</tr>
<tr>
<td>
Company RA Code (if any):<br>
' . $_POST["ra_code"] . '
</td>
<td>
Name of Company:<br>
' . $_POST["company_name"] . '
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
Company Address:<br>
' . $_POST["company_address"] . '
</td>
</tr>
<tr>
<td>
Position:<br>
' . $_POST["position"] . '
</td>
<td>
IATA Code (if any):<br>
' . $_POST["iata_code"] . '
</td>
<td>
</td>
</tr>
<tr>
<td>
Tel.:<br>
' . $_POST["tel"] . '
</td>
<td>
Mobile:<br>
' . $_POST["mobile"] . '
</td>
<td>
</td>
</tr>
<tr>
<td>
E-mail:<br>
' . $_POST["email"] . '
</td>
<td>
CC E-mail:<br>
' . $_POST["cc_email"] . '
</td>
<td>
Fax:<br>
' . $_POST["fax"] . '
</td>
</tr>
<tr>
<td colspan="3">
Experience in air cargo industry:<br>
' . $_POST["exp_air_cargo"] . '
</td>
</tr>
<tr>
<td colspan="3">
<br>
<b>OTHERS INFORMATION</b>
</td>
</tr>
<tr>
<td>
Education Level:<br>
' . $_POST["education_level"] . '
</td>
<td>
Existing airfreight compliance client od Alliance:<br>
' . $_POST["existing_airfreight"] . '
</td>
<td>
</td>
</tr>
<tr>
<td>
Are you renewing the certificate?:<br>
' . $_POST["renew_cert"] . '
</td>
<td>
Date of obtain previous certificate:<br>
' . $_POST["date_obtain_pre_cert"] . '
</td>
<td>
</td>
</tr>
<tr>
<td>
Institution of issuing:<br>
' . $_POST["institution_issuing"] . '
</td>
<td>
Have you ever enroll the DG Training?<br>
' . $_POST["have_enroll_dg_training"] . '
</td>
<td>
</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($_POST["email"], $_POST["participant_name"]);
$x_mail->AddBCC($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>";
}
$sql = "insert into enrollment set course_fee = ?,ref_code = ?, enrollment_date=?, sent_email=?, company_name_diff=?, company_address_diff=?, createdate=?, createby=?, lastupdate=?, lastupby=?, ";
$parameters = array($course_info["fee"], $ref_code, date("Y-m-d"), $sent_email, $company_name_diff, $company_address_diff, $nowdate, 0, $nowdate, 0);
foreach ($_POST as $key => $value) {
if ($key == "verification") {
continue;
}
$sql .= $key . "=?, ";
if ($key == "participant_name" || $key == "identity_id" || $key == "tel" || $key == "mobile" || $key == "email" || $key == "cc_email") {
$parameters[] = rsa_crypt($value, 1);
} else {
$parameters[] = $value;
}
}
$sql = substr_replace($sql, "", -2);
bind_pdo($sql, $parameters);
$lastInsertId = $dbh->lastInsertId();
if ($lastInsertId) {
$_SESSION["enrollment_success"] = 1;
$_SESSION["ref_code"] = $ref_code;
echo "<script>alert('We have record your course enrollment. You will receive an email with your enrollment information soon.'); location.href='enrollment_success.php';</script>";
} else {
echo "<script>alert('We cannot record your course enrollment. Please try again.'); history.back();</script>";
}
}else{
echo "<script type='text/javascript'>
alert('Please enter correct verification code.');
history.back();
</script>";
exit;
}