| 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/chineseaaedu/tc/ |
Upload File : |
<? include('_init.php');?>
<? if(@$_POST['action']=='registration'){
ini_set('display_errors',0);
if (!function_exists('call_curl')) {
function call_curl($url, $postData, $post)
{
if (!empty($post)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$result = curl_exec($ch);
curl_close($ch);
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
curl_close($ch);
}
return $result;
}
}
$lang = $data['lang'];
$url = "https://www.google.com/recaptcha/api/siteverify";
$post_data = array("secret" => '6Ld8JxoTAAAAAOQU6SZoYVFRJ_ioLc_gQnb-0m6Y', "response" => $_POST["g-recaptcha-response"]);
$result = call_curl($url, $post_data, 1);
$result_array = json_decode($result, true);
if (!$result_array["success"]) {
echo '<script>alert("驗證碼錯誤");location.href="login.php"</script>';
}else{
$data = $_POST;
$sql = 'INSERT INTO `member` (`name`,`email`,`password`,`is_email`,`createdate`,`status`,`deleted`) values (?,?,?,?,?,?)';
$parameters = array($data['name'],$data['email'],md5($data['password']),$data['is_email'],date('Y-m-d'),1,0);
if (!($sth = $dbh->prepare($sql))) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute($parameters)) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
echo '<script>alert("註冊成功");location.href="login.php"</script>';
exit();
}
exit();
}?>
<!DOCTYPE html>
<html lang="<?=$lang?>">
<head>
<? include('_head.php');?>
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" href="../css/form-elements.css">
<link rel="stylesheet" href="../css/loginStyle.css">
<script src='https://www.google.com/recaptcha/api.js'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(function(){
$('#login-form').submit(
function(){
return false;
}
);
})
function submitRegistration(){
var error = false;
$.post('../_ajax.php', {
ajax: 'cheackMember',
email: $('#registration-form input[name="email"]').val()
}, function(json) {
var str = JSON.parse(json);
$('#registration-form input').removeClass('failed');
if(!$('#registration-form input[name="name"]').val()){
$('#registration-form input[name="name"]').addClass('failed');
error = true;
}
if(!$('#registration-form input[name="email"]').val()){
$('#registration-form input[name="email"]').addClass('failed');
error = true;
}else{
if(! /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test($('#registration-form input[name="email"]').val())){
$( '#registration-form input[name="email"]' ).addClass('failed');
error = true;
}else{
if(str.status == false){
$( '#registration-form input[name="email"]' ).addClass('failed');
error = true;
}
}
}
if(!$('#registration-form input[name="password"]').val()){
$( "#registration-form input[name='password']" ).addClass('failed');
error = true;
}
if(!$('input[name="re_password"]').val()){
//msg += '<li>Comfirm Password - Mandatory Field</li>';
$( "#registration-form input[name='re_password']" ).addClass('failed');
error = true;
}
if($('#registration-form input[name="password"]').val() && $('#registration-form input[name="re_password"]').val()){
if($('input[name="password"]').val() != $('input[name="re_password"]').val()){
//msg += '<li>Comfirm Password - Must Same with Password</li>';
$( "#registration-form input[name='re_password']" ).addClass('failed');
error = true;
}
}
if(error == false){
$('#registration-form').submit();
console.log('a');
return true;
}
});
}
</script>
</head>
<body>
<!-- Top content -->
<div class="top-content">
<div class="inner-bg">
<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-offset-2 text">
<h1><strong><a href="index.html">中華青年宇航學社</a></strong></h1>
<div class="description">
<p> 宗旨: 對中國航天發展過程認識及了解,從而對國民身份的認同 <br>
對象:青少年,香港中小學生,大學生,在職青年 </strong> </p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-5">
<div class="form-box">
<div class="form-top">
<div class="form-top-left">
<h3>登入</h3>
<p>請輸入用戶名稱及密碼:</p>
</div>
<div class="form-top-right"> <i class="fa fa-lock"></i> </div>
</div>
<div class="form-bottom">
<form role="form" action="" method="post" class="login-form">
<div class="form-group">
<label class="sr-only" for="form-username">Username</label>
<input type="text" name="form-username" placeholder="用戶名稱..." class="form-username form-control" id="form-username">
</div>
<div class="form-group">
<label class="sr-only" for="form-password">Password</label>
<input type="password" name="form-password" placeholder="密碼..." class="form-password form-control" id="form-password">
</div>
<button type="submit" class="btn">登入</button>
</form>
</div>
</div>
</div>
<div class="col-sm-1 middle-border"></div>
<div class="col-sm-1"></div>
<div class="col-sm-5">
<div class="form-box">
<div class="form-top">
<div class="form-top-left">
<h3>註冊</h3>
<p>請輸入以下資料以便註冊:</p>
</div>
<div class="form-top-right"> <i class="fa fa-pencil"></i> </div>
</div>
<div class="form-bottom">
<form role="form" action="" method="post" id="registration-form">
<input type="hidden" name="action" value="registration"/>
<div class="form-group">
<input type="text" name="name" placeholder="用戶名稱..." class="form-first-name form-control">
</div>
<div class="form-group">
<input type="text" name="email" placeholder="電郵地址..." class="form-email form-control" >
</div>
<div class="form-group">
<input type="password" name="password" placeholder="密碼..." class="form-last-name form-control">
</div>
<div class="form-group">
<input type="password" name="re_password" placeholder="確認密碼..." class="form-last-name form-control" >
</div>
<div class="form-group">
<label><input type="checkbox" name="is_email" value="1" checked style="margin-right:5px;"/>我特此同意接收市場推廣的資料、資訊溝通、推銷廣告、通訊及任何中華青年宇航學社 及其相關公司、附屬公司、子公司及聯營公司等關於產品及服務的傳訊。</label>
</div>
<div class="form-group">
<div class="g-recaptcha" data-sitekey="6Ld8JxoTAAAAAJRyv8SC2sG8UMn93LguA0lb0e7j"></div>
</div>
<button type="button" class="btn" onClick="submitRegistration()">註冊</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>