| 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/ifapc/html_20210817/tc/ |
Upload File : |
<?php /*
<?php
if (!session_id()) {
session_start();
}
$_SESSION['fields_data'] = array(
'name' => array(
'label' => '姓名',
'type' => 'text',
'required' => true,
),
'email' => array(
'label' => '電子郵件',
'type' => 'email',
'required' => true,
),
'phone' => array(
'label' => '電話',
'type' => 'text',
),
'subject' => array(
'label' => '主題',
'type' => 'text',
'required' => true,
),
'message' => array(
'label' => '信息',
'type' => 'text',
'required' => true,
),
'captcha_code' => array(
'label' => '驗証驗',
'type' => 'text',
'required' => true,
),
);
function html_required($field, $type = 'attribute')
{
if (isset($_SESSION['fields_data'][$field]['required']) && $_SESSION['fields_data'][$field]['required']) {
if ($type == 'symbol') {
return '<small>*</small>';
} else {
return 'required';
}
}
};
function get_post($field)
{
if (!empty($_POST) && !empty($_POST[$field])) {
return $_POST[$field];
}
}
function validate_email($string)
{
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
return preg_match($pattern, $string);
}
function validation()
{
foreach ($_POST as $field => $value) {
if (isset($_SESSION['fields_data'][$field]['required']) && $_SESSION['fields_data'][$field]['required'] && empty($_POST[$field])) {
$_SESSION['error'][$_SESSION['fields_data'][$field]['label']] = '請輸入 ';
}
if ($field == 'captcha_code' && $value != $_SESSION['captcha']) {
$_SESSION['error'][$_SESSION['fields_data'][$field]['label']] = '請輸入正確的 ';
}
if ($field == 'email' && !validate_email($value)) {
$_SESSION['error'][$_SESSION['fields_data'][$field]['label']] = '格式錯誤 ';
}
}
};
function log_email($data, $status) {
ob_start();
var_dump($data);
$getOb = ob_get_clean();
$fileName = '..' . DIRECTORY_SEPARATOR . 'email_logs' . DIRECTORY_SEPARATOR . $status . DIRECTORY_SEPARATOR . date('Ymd') .'.php';
file_put_contents($fileName, date('H:i:s') . ' ' . __FILE__ . ' -0- ' . "\r\n" . $getOb . "\r\n", FILE_APPEND);
}
function send_email()
{
require_once '../lib/PHPMailer/src/Exception.php';
require_once '../lib/PHPMailer/src/PHPMailer.php';
require_once '../lib/PHPMailer/src/SMTP.php';
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$mail->CharSet = "UTF-8";
//Server settings
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.sendgrid.net';
$mail->Port = 587;
$mail->SMTPAuth = true;
$config['smtp_user'] = 'apikey';
$config['smtp_pass'] = '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';
$mail->SMTPSecure = 'tls';
//Recipients
$mail->setFrom($_POST['email'], $_POST['name']);
$mail->addAddress('staraward@hksme.hk', 'staraward'); // Add a recipient
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Staraward (Contant us)';
$body = '<b>姓名: </b>' . $_POST['name'] . '<br><br>';
$body .= '<b>電子郵件: </b>' . $_POST['email'] . '<br><br>';
$body .= '<b>電話: </b>' . $_POST['phone'] . '<br><br>';
$body .= '<b>主題: </b>' . $_POST['subject'] . '<br><br>';
$body .= '<b>信息: </b>' . $_POST['message'];
$mail->Body = $body;
if ($mail->send()) {
log_email($_POST['email'], 'success');
$_SESSION['msg_type'] = 'success';
$_SESSION['msg'] = '成功發送電郵';
header('Location: message.php');
} else {
log_email($mail->ErrorInfo, 'error');
$_SESSION['msg_type'] = 'error';
$_SESSION['msg'] = '發送電郵失敗';
header('Location: message.php');
}
}
if (!empty($_POST)) {
validation();
if (empty($_SESSION['error'])) {
send_email();
}
}
$captcha_path = '../lib/captcha/captcha.php';
?>*/ ?>
<!DOCTYPE html>
<html dir="ltr" lang="zh-HK">
<head>
<?php include 'inc/metahead.php'; ?>
<title>聯絡我們 | 香港股票分析師協會上市公司年度大獎</title>
</head>
<body class="stretched">
<!-- Document Wrapper
============================================= -->
<div id="wrapper" class="clearfix">
<!-- Header
============================================= -->
<?php include 'inc/header.php'; ?>
<section id="page-title" style="background-image: url('../images/banner_sub.jpg?v=2021');"
class="background-title">
<div class="container clearfix">
<h1 class="colorFFF m0">聯絡我們</h1>
<ol class="breadcrumb">
<li><a href="#">主頁</a></li>
<li class="active">聯絡我們</li>
</ol>
</div>
</section>
<!-- Content
============================================= -->
<section id="content">
<div class="bg_section_cover"
style="padding-top:30px; padding-bottom:0;background-image: url('../images/bridge_bg.jpg');">
<div class="container clearfix">
<div class="row">
<div class="col-md-12">
<h3>香港股票分析師協會</h3>
<b>香港股票分析師協會網站:<a href="http://www.ifapc.org" class="link"
target="_blank">http://www.ifapc.org/</a></b><br>
<strong>微信號:</strong>HKIFAPC
</p>
</div>
</div>
<h3>聯絡我們</h3>
<form method="post" action="contact_controler.php" role="form">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="companyName">公司名稱:</label>
<input type="text" class="form-control" name="companyName" id="companyName"
placeholder="" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="name">聯絡人:</label>
<input type="text" class="form-control" id="name" name="name" placeholder=""
required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="phone">聯絡人電話:</label>
<input type="text" class="form-control" id="phone" name="phone" placeholder=""
maxlength="8" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="email">電子郵件:</label>
<input type="email" class="form-control" id="email" name="email" placeholder=""
required>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="detial">信息:</label>
<textarea class="form-control" id="detial" rows="3" name="detial"></textarea>
</div>
</div>
</div>
<button type="submit" class="button button-dark button-rounded"
style="background-color: #2a3c7c ;">傳 送</a>
</form>
<br>
<br>
<!-- Postcontent
============================================= -->
<?php /* <div class="postcontent nobottommargin">
<div class="contact-widget">
<div class="contact-form-result"></div>
<form action="contact.php" method="post" accept-charset="UTF-8" class="nobottommargin"
id="contactform" name="contactform">
<?php if (!empty($_SESSION['error'])) {?>
<div class="alert alert-danger">
<?php foreach ($_SESSION['error'] as $field => $msg) {?>
<p><?php echo $msg; ?><strong><?php echo $field; ?></strong></p>
<?php }?>
</div>
<?php unset($_SESSION['error']);?>
<?php }?>
<div class="form-process"></div>
<div class="col_one_third">
<?php $field = 'name';?>
<label for="<?php echo $field; ?>"><?php echo $_SESSION['fields_data'][$field]['label']; ?>
<?php echo html_required($field, 'symbol'); ?></label>
<input type="<?php echo $_SESSION['fields_data'][$field]['type']; ?>" id="<?php echo $field; ?>"
name="<?php echo $field; ?>" value="<?php echo get_post($field); ?>" class="sm-form-control"
<?php echo html_required($field); ?>>
</div>
<div class="col_one_third">
<?php $field = 'email';?>
<label for="<?php echo $field; ?>"><?php echo $_SESSION['fields_data'][$field]['label']; ?>
<?php echo html_required($field, 'symbol'); ?></label>
<input type="<?php echo $_SESSION['fields_data'][$field]['type']; ?>" id="<?php echo $field; ?>"
name="<?php echo $field; ?>" value="<?php echo get_post($field); ?>" class="sm-form-control"
<?php echo html_required($field); ?>>
</div>
<div class="col_one_third col_last">
<?php $field = 'phone';?>
<label for="<?php echo $field; ?>"><?php echo $_SESSION['fields_data'][$field]['label']; ?>
<?php echo html_required($field, 'symbol'); ?></label>
<input type="<?php echo $_SESSION['fields_data'][$field]['type']; ?>" id="<?php echo $field; ?>"
name="<?php echo $field; ?>" value="<?php echo get_post($field); ?>" class="sm-form-control"
<?php echo html_required($field); ?>>
</div>
<div class="clear"></div>
<div class="col_two_third">
<?php $field = 'subject';?>
<label for="<?php echo $field; ?>"><?php echo $_SESSION['fields_data'][$field]['label']; ?>
<?php echo html_required($field, 'symbol'); ?></label>
<input type="<?php echo $_SESSION['fields_data'][$field]['type']; ?>" id="<?php echo $field; ?>"
name="<?php echo $field; ?>" value="<?php echo get_post($field); ?>" class="sm-form-control"
<?php echo html_required($field); ?>>
</div>
<div class="clear"></div>
<div class="col_full">
<?php $field = 'message';?>
<label for="<?php echo $field; ?>"><?php echo $_SESSION['fields_data'][$field]['label']; ?>
<?php echo html_required($field, 'symbol'); ?></label>
<input type="<?php echo $_SESSION['fields_data'][$field]['type']; ?>" id="<?php echo $field; ?>"
name="<?php echo $field; ?>" value="<?php echo get_post($field); ?>" class="sm-form-control"
<?php echo html_required($field); ?>>
</div>
<div class="clear"></div>
<span id="captcha_span"><img id="captcha_image" src="<?php echo $captcha_path; ?>" width="150"
height="40" border="0" alt="CAPTCHA"></span>
<img id="refresh_captcha" src="../images/icons/refresh.png" border="0" alt="refresh_captcha">
<div class="col_full">
<?php $field = 'captcha_code';?>
<label for="<?php echo $field; ?>"><?php echo $_SESSION['fields_data'][$field]['label']; ?>
<?php echo html_required($field, 'symbol'); ?></label>
<input type="<?php echo $_SESSION['fields_data'][$field]['type']; ?>" id="<?php echo $field; ?>"
name="<?php echo $field; ?>" value="" class="sm-form-control"
<?php echo html_required($field); ?>>
</div>
<br>
<div class="clear"></div>
<div class="col_full">
<button class="button button-3d nomargin" type="submit" id="submit" name="submit"
value="submit">傳送信息</button>
</div>
</form>
</div>
</div><!-- .postcontent end -->*/ ?>
<!-- Sidebar
============================================= -->
</div>
</div>
</section><!-- #content end -->
<?php include 'inc/footer.php'; ?>
</div><!-- #wrapper end -->
<!-- Go To Top
============================================= -->
<div id="gotoTop" class="icon-angle-up"></div>
<!-- External JavaScripts
============================================= -->
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/plugins.js?v=1.22"></script>
<!-- Footer Scripts
============================================= -->
<script type="text/javascript" src="../js/functions.js?v=1.22"></script>
<script type="text/javascript">
$('nav ul > li.lv01:nth-child(8)').addClass('current');
</script>
<script>
$(function() {
$('#refresh_captcha').on('click', function() {
$('[name="captcha_code"]').val('').focus();
$('#captcha_image').prop('src', '<?php echo $captcha_path; ?>?r=' + Math.random());
});
$('#captcha_span').attr('style', $('#captcha_span img').attr('style'));
});
var $form = $("form");
$.validator.addMethod("letters", function(value, element) {
return this.optional(element) || value == value.match(/^[a-zA-Z\s]*$/);
});
$form.validate({
rules: {
companyName: {
required: true,
minlength: 3
},
name: {
required: true,
minlength: 3
},
phone: {
required: true,
minlength: 8
},
email: {
required: true,
email: true
}
},
messages: {
companyName: "請輸入公司名稱",
name: "請輸入聯絡人",
phone: "請輸入聯絡人電話",
email: "請輸入正確電子"
},
submitHandler: function() {
return true;
}
});
</script>
<script>
/* var submitting = false;
$('form').on("submit", function(e) {
if (submitting) {
e.preventDefault();
} else {
$(this).find('button[type="submit"]').html("處理中...")
submitting = true;
}
});*/
</script>
</body>
</html>
<?php /*
<?php unset($_SESSION['fields_data']);?> */ ?>