個人賬戶',
'退出');
$login_status = 1;
}
} else {
$login_title = array(
'註冊',
'登錄',
'個人賬戶',
);
$login_status = 0;
}
//先判断上次是否选择自动登录
$bdauth = !empty($_COOKIE[$cookiepre . 'autologin']) ? $_COOKIE[$cookiepre . 'autologin'] : '';
if (!empty($bdauth)) {
list($id, $username, $password) = explode("\t", dz_authcode($bdauth,'DECODE'));
if (!empty($username) && !empty($password)) {
$username = replace_specialChar($username);
$password = replace_specialChar($password);
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
}
}
$tab_id = isset($_GET['tab_id']) ? intval($_GET['tab_id']) : 0;
if ($tab_id == 0) {
if ($_POST['act'] == 'club') {
$seccode = !empty($_POST['seccode']) ? $_POST['seccode'] : '';
if(!$seccode || strtolower($seccode) != strtolower($_SESSION['seccode'])){
$seccode = '';
}
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$password = isset($_POST['password']) ? trim($_POST['password']) : '';
$username = replace_specialChar($username);
$password = replace_specialChar($password);
$type = isset($_POST['type']) ? trim($_POST['type']) : 0;
$password = md5($password);
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
//是否下次自动登录
if ($type == 1) {
$bdauth = dz_authcode('a'. "\t" . $username . "\t" . $password, "ENCODE") ;
bdsetcookie('autologin', $bdauth, time()+60*60*12);
}
if(empty($seccode)){
$message = '驗證碼有誤,請重新輸入!';
} else if ($username && $password) {
$sql = "SELECT u_id, status FROM oppo_bd.bd_club_user
WHERE user_name = '{$username}' AND password = '{$password}' LIMIT 1";
$row = $db->getRow($sql);
if ($row['u_id']) {
$_SESSION['u_id'] = $row['u_id'];
//登录之后创建cookie
$bdauth = dz_authcode($_SESSION['u_id'] . "\t" . 'login' . "\t" . 'true', "ENCODE") ;
bdsetcookie('logging_status', $bdauth, time()+60*10);
$bdauth1 = dz_authcode($_SESSION['u_id'] . "\t" . 'admin' . "\t" . 'oppo', "ENCODE") ;
//管理员查看产品注册
if ($row['status'] == 1) {
bdsetcookie('status', $bdauth1, time()+60*60*2);
if ($act == 'product') {
header("Location: product-manager-main.php");
exit();
} else {
header("Location: ask.php");
exit();
}
} else {
//页面跳转
bdsetcookie('status');
if ($act == 'product') {
header("Location:product-certification.php");
exit();
} elseif ($act == 'user-info') {
header("Location:product-user-info.php");
exit();
} else {
header("Location: ask.php");
exit();
}
}
} else {
$message = '用户名或密码有误,请重新登录';
}
}
}
}
function replace_specialChar($strParam){
$regex = "/\/|\~|\#|\\$|\%|\^|\&|\(|\)|\{|\}|\:|\<|\>|\?|\[|\]|\/|\;|\'|\`|\=|\\\|\|/";
return preg_replace($regex,"",$strParam);
}
include Zandy_Template::outCache('club_login', $siteConf['tplDir'], $siteConf['cacheDir']);
if (isset($message) && $message) {
alert($message);
}
?>