更新项目 完成登陆注册部分...

Signed-off-by: 502647092 <jtb1@163.com>
master
502647092 2015-11-06 18:12:15 +08:00
parent 6dd800f2e2
commit 9dfe8fa4a7
18 changed files with 2035 additions and 63 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
**/RunTime/*
.settings
**/RunTime

View File

@ -0,0 +1,19 @@
<?php
/**
* 检测用户是否登录
* @return integer 0-未登录大于0-当前登录用户ID
*/
function is_login() {
$user = session ( 'user' );
if (empty ( $user )) {
return 0;
} else {
return $user ['uid'];
}
}
// 检测输入的验证码是否正确,$code为用户输入的验证码字符串
function check_verify($code, $id = '') {
$verify = new \Think\Verify ();
return $verify->check ( $code, $id );
}

View File

@ -4,8 +4,8 @@ return array (
'DB_TYPE' => 'mysql', // 数据库类型
'DB_HOST' => '127.0.0.1', // 服务器地址
'DB_NAME' => 'minecraft', // 数据库名
'DB_USER' => 'minecraft', // 用户名
'DB_PWD' => '325325', // 密码
'DB_USER' => 'root', // 用户名
'DB_PWD' => 'root', // 密码
'DB_PORT' => 3306, // 端口
'DB_CHARSET' => 'utf8'
); // 数据库字符集

View File

@ -1,13 +1,4 @@
<?php
<?php
return array (
// 添加数据库配置信息
'DB_TYPE' => 'mysql', // 数据库类型
'DB_HOST' => '127.0.0.1', // 服务器地址
'DB_NAME' => 'minecraft', // 数据库名
'DB_USER' => 'root', // 用户名
'DB_PWD' => 'root', // 密码
'DB_PORT' => 3306, // 端口
'DB_PREFIX' => '', // 数据库表前缀
'DB_CHARSET' => 'utf8'
) // 数据库字符集
;
/* 模板相关配置 */
'TMPL_PARSE_STRING' => array ('__IMG__' => __ROOT__ . '/Public/images','__CSS__' => __ROOT__ . '/Public/css','__JS__' => __ROOT__ . '/Public/js' ) );

View File

@ -0,0 +1,25 @@
<?php
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {
public function Header() {
$this->test = 'Header';
$this->display ();
}
public function Master() {
$this->test = 'Master';
$this->display ();
}
public function Banner() {
$this->test = 'Banner';
$this->display ();
}
public function Verify() {
ob_clean ();
$Verify = new \Think\Verify ();
$Verify->entry ();
}
}

View File

@ -1,11 +1,27 @@
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$data=M('authme')->select();
dump($data);
$this->data->$data;
$this->display();
}
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function Login($username="", $password="", $verify = null) {
if(IS_POST){
$User = A ( 'User' );
$te = $User->Login ( $username, $password, $verify );
dump ( $te );
$this->display ();
}
}
/* 退出登录 */
public function Logout() {
if (is_login ()) {
session ( 'user', null );
session ( '[destroy]' );
$this->success ( '退出成功!', U ( 'login' ) );
} else {
$this->redirect ( 'login' );
}
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Home\Controller;
use Think\Controller;
class MailController extends Controller {
public function Check($mail) {
$data = M ( 'mail' )->where ( array ('address' => $mail ) )->find ();
if ($data == null) {
$this->success ( "邮箱未被注册!", '', true );
} else {
$this->error ( "邮箱已被注册!", '', true );
}
}
}

View File

@ -12,56 +12,49 @@ class UserController extends Controller {
$this->display ();
// $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b></p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
}
public function Login($username, $password) {
$data = M ( 'authme' )->where ( array (
'username' => $username,
'password' => $password
) )->find ();
public function Check($username) {
$data = M ( 'authme' )->where ( array ('username' => $username ) )->find ();
if ($data != null) {
$this->ajaxReturn ( array (
status => 1,
msg => "登录成功!"
) );
$this->success ( "用户已注册!", '', true );
} else {
$this->ajaxReturn ( array (
status => 0,
msg => "登录失败 用户名或密码错误!"
) );
$this->error ( "用户未注册!", '', true );
}
}
public function Login($username, $password, $verify = null) {
$data = M ( 'authme' )->where ( array ('username' => $username,'password' => md5 ( $password ) ) )->find ();
if (IS_POST) {
/* 检测验证码 */
if (! check_verify ( $verify )) {
$this->error ( '验证码输入错误!' );
}
}
if ($data != null) {
$this->success ( "登录成功!", U ( 'Index/Index' ), true );
} else {
$this->error ( "登录失败 用户名或密码错误!", U ( 'Index/Login' ), true );
}
}
public function Register($username, $password, $ip = '127.0.0.1', $mail = 'authme@citycraft.cn') {
$modelAuthMe = M ( 'authme' );
$result = $modelAuthMe->where ( array (
username => $username
) )->find ();
$result = $modelAuthMe->where ( array (username => $username ) )->find ();
if ($result != null) {
$this->ajaxReturn ( array (
status => 0,
msg => "注册失败,用户已存在!"
) );
$this->ajaxReturn ( array (status => "error",msg => "注册失败,用户已存在!" ) );
}
$value = array (
'username' => $username,
'password' => $password,
'password' => md5 ( $password ),
'ip' => $ip,
'lastlogin' => '',
'x' => '0',
'y' => '0',
'z' => '0',
'world' => 'world',
'email' => $mail
);
'email' => $mail );
$result = $modelAuthMe->save ( $value );
if ($result) {
$this->ajaxReturn ( array (
status => 1,
msg => "注册成功!"
) );
$this->ajaxReturn ( array (status => "success",msg => "注册成功!" ) );
} else {
$this->ajaxReturn ( array (
status => 0,
msg => "注册失败!"
) );
$this->ajaxReturn ( array (status => "error",msg => "注册失败!" ) );
}
}
}

View File

@ -0,0 +1,99 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=7;IE=9;IE=10" />
<include file="Common:JS_CSS" />
<title><block name="PageTitle"></block></title>
<block name="Head"></block>
</head>
<body>
<div class="header">
<div class="con">
<h1 class="logo">Mc魔方联机</h1>
</div>
</div>
<div class="wrap">
<div class="banner-show" id="js_ban_content">
<div class="cell bns-01">
<div class="con"></div>
</div>
<div class="cell bns-02" style="display: none;">
<div class="con"></div>
</div>
<div class="cell bns-03" style="display: none;">
<div class="con"></div>
</div>
</div>
<div class="banner-control" id="js_ban_button_box">
<a href="javascript:;" class="left"></a> <a href="javascript:;"
class="right">右</a>
</div>
<block name="Body"></block>
</div>
<script type="text/javascript">
(function() {
var defaultInd = 0;
var list = $('#js_ban_content').children();
var count = 0;
var change = function(newInd, callback) {
if (count)
return;
count = 2;
$(list[defaultInd]).fadeOut(400, function() {
count--;
if (count <= 0) {
if (start.timer)
window.clearTimeout(start.timer);
callback && callback();
}
});
$(list[newInd]).fadeIn(400, function() {
defaultInd = newInd;
count--;
if (count <= 0) {
if (start.timer)
window.clearTimeout(start.timer);
callback && callback();
}
});
}
var next = function(callback) {
var newInd = defaultInd + 1;
if (newInd >= list.length) {
newInd = 0;
}
change(newInd, callback);
}
var start = function() {
if (start.timer)
window.clearTimeout(start.timer);
start.timer = window.setTimeout(function() {
next(function() {
start();
});
}, 8000);
}
start();
$('#js_ban_button_box').on('click', 'a', function() {
var btn = $(this);
if (btn.hasClass('right')) {
//next
next(function() {
start();
});
} else {
//prev
var newInd = defaultInd - 1;
if (newInd < 0) {
newInd = list.length - 1;
}
change(newInd, function() {
start();
});
}
return false;
});
})();
</script>
</body>
</html>

View File

@ -0,0 +1,5 @@
<link href="__CSS__/home.css?v=2" rel="stylesheet" type="text/css" />
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" rel="stylesheet" />
<script src="//cdn.bootcss.com/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=7;IE=9;IE=10" />
<include file="Common:JS_CSS" />
<title><block name="PageTitle"></block></title>
<block name="Head"></block>
</head>
<body>
<div class="header">
<div class="con">
<h1 class="logo">Mc魔方联机</h1>
</div>
</div>
<block name="Body"></block>
</body>
</html>

View File

@ -0,0 +1,75 @@
<extend name="Common:Banner" />
<block name="PageTitle">魔方 - 我的世界</block>
<block name="Body">
<div class="container">
<div class="register-box">
<div class="reg-slogan">
<font size="5" face="微软雅黑">用户登录</font>
</div>
<form class="form-horizontal" action="{:U('User/Login')}" role="form" method="post">
<div class="form-group">
<label for="username" class="col-sm-offset-1 col-sm-3 control-label">用户名:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="username" name="username" placeholder="用户名" required />
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-offset-1 col-sm-3 control-label">&nbsp; &nbsp;码:</label>
<div class="col-sm-6">
<input type="password" class="form-control" id="password" name="password" placeholder="密码" required />
</div>
</div>
<div class="form-group">
<label for="verify" class="col-sm-offset-1 col-sm-3 control-label">验证码:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="verify" name="verify" placeholder="验证码" required />
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-offset-1 col-sm-3 control-label"></label>
<div class="col-sm-6">
<img src="{:U('Common/Verify')}" id="" class="verifyimg reloadverify" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-7">
<button id="submit" type="button" class="btn btn-primary btn-login">登陆</button>
</div>
</div>
<div class="form-group">
<p class="check-tips text-danger col-sm-offset-3 col-sm-7"></p>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#submit").click(function() {
var user = $("#username").val();
var pass = $("#password").val();
var verify = $("#verify").val();
if (user == "") {
alert("用户名不能为空!");
return;
}
if (pass == "") {
alert("密码不能为空!");
return;
}
$.ajax({
type : "POST",
data : {
username : user,
password : pass,
verify : verify
},
dataType : "json",
url : "{:U('User/Login')}",
success : function(rdata) {
alert(rdata.info);
window.location.href = rdata.url;
}
});
});
});
</script> </block>

View File

@ -0,0 +1,131 @@
<extend name="Common:Banner" />
<block name="PageTitle">魔方 - 我的世界</block>
<block name="Body">
<div class="container">
<div class="register-box">
<div class="reg-slogan">
<font size="5" face="微软雅黑">用户登录</font>
</div>
<form class="form-horizontal" action="{:U('login','','')}" role="form" method="post">
<div class="form-group">
<label for="username" class="col-sm-offset-1 col-sm-3 control-label">用户名:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="username" name="username" placeholder="用户名" required />
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-offset-1 col-sm-3 control-label">&nbsp; &nbsp;码:</label>
<div class="col-sm-6">
<input type="password" class="form-control" id="password" name="password" placeholder="密码" required />
</div>
</div>
<div class="form-group">
<label for="checkpassword" class="col-sm-offset-1 col-sm-3 control-label">重复密码:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="checkpassword" name="checkpassword" placeholder="重复密码" required />
</div>
</div>
<div class="form-group">
<label for="verify" class="col-sm-offset-1 col-sm-3 control-label">&nbsp; &nbsp;箱:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="verify" name="verify" placeholder="邮箱" required />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-7">
<button id="submit" type="button" class="btn btn-primary btn-register">注册</button>
</div>
</div>
<div class="form-group">
<p class="check-tips text-danger col-sm-offset-3 col-sm-7"></p>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$("#register").click(function() {
var RegexEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)*\w+$/;
var RegexUserName = /^[a-zA-Z0-9_?]*$/;
var username = $("#username");
var password = $("#password");
var email = $("#email");
if (username.val() == "") {
alert("用户名不能为空!");
return false
}
if (username.val().length < 3 || username.val().length > 16) {
alert("帐号长度不得低于3位或大于16位!");
return
}
if (!RegexUserName.test(username.val())) {
alert("帐号必须以小写字母+数字+下划线组成!");
return
}
if (pass.val() == "") {
alert("密码不能为空!");
return false
}
if (pass.val().length < 6) {
alert("密码强度不能低于6位!");
return false
}
if (email.val() == "") {
alert("邮箱不能为空!");
return false
}
if (!RegexEmail.test(email.val())) {
alert("邮箱格式不正确!");
$('#email').val("");
return false
}
$.ajax({
url: "{:U('User/Check')}",
type: "GET",
data: {
user: username.val()
},
dataType: "json",
success: function(rdata) {
switch (rdata.status) {
case 1:
$.ajax({
url: "{:U('Mail/Check')}",
type: "GET",
data: {
mail: email.val()
},
dataType: "json",
success: function(s) {
switch (s.status) {
case 1:
$.ajax({
type: "POST",
data: {
user: username.val(),
pass: pass.val(),
mail: email.val()
},
dataType: "json",
url: "<?=Url('user_public','register')?>",
success: function(C) {
alert(C.info);
location.href = "<?=Url('index','index')?>"
}
}) break;
case 0:
alert(s.info);
return false
}
}
}) break;
case 0:
alert(rdata.info);
return false
}
},
error: function() {
alert("注册失败 请检查网络是否通畅!")
}
})
})
</script></block>

View File

@ -0,0 +1,195 @@
<!DOCTYPE html>
<html>
<head>
<title>魔客吧整理jquery实现115网盘首页登录+注册+通栏banner广告js特效代码 魔客吧 - www.moke8.com</title>
<meta name="title" content="jquery实现115网盘首页登录+注册+通栏banner广告js特效代码" />
<meta name="keywords" content="jquery实现115网盘首页登录+注册+通栏banner广告js特效代码" />
<meta name="description" content="jquery实现115网盘首页登录+注册+通栏banner广告js特效代码" />
<meta charset="UTF-8">
<link href="css/home.css?v=2" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
</head>
<body>
<div class="header">
<div class="con">
<h1 class="logo">Mc魔方联机</h1>
<div class="top-login">
<div id="js-login_box" style="">
<form action="" id="js-login_form" method="post">
<div class="cell">
<label for="js-account">帐号</label>
<input type="text" name="account" id="js-account" tabindex="1" class="text" value="" />
</div>
<div class="cell">
<label for="js-passwd">密码</label>
<input type="password" name="passwd" id="js-passwd" class="text" tabindex="2" />
<b class="icon-form ifm-secure" >安全提示</b>
</div>
<button type="button" class="button" id="js-submit" tabindex="3">登录</button>
<div class="bottom">
<a href="###" id="js-forgot_passwd" tabindex="6">忘记密码?</a>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="wrap">
<div class="banner-show" id="js_ban_content">
<div class="cell bns-01">
<div class="con"></div>
</div>
<div class="cell bns-02" style="display:none;">
<div class="con">
<a href="http://www.mfcraft.cn" target="_blank" class="banner-link"><i>1</i></a>
</div>
</div>
<div class="cell bns-03" style="display:none;">
<div class="con">
<a href="http://www.mfcraft.cn" target="_blank" class="banner-link"><i>2</i></a>
</div>
</div>
</div>
<div class="banner-control" id="js_ban_button_box">
<a href="javascript:;" class="left"></a>
<a href="javascript:;" class="right"></a>
</div>
<script type="text/javascript">
;(function(){
var defaultInd = 0;
var list = $('#js_ban_content').children();
var count = 0;
var change = function(newInd, callback){
if(count) return;
count = 2;
$(list[defaultInd]).fadeOut(400, function(){
count--;
if(count <= 0){
if(start.timer) window.clearTimeout(start.timer);
callback && callback();
}
});
$(list[newInd]).fadeIn(400, function(){
defaultInd = newInd;
count--;
if(count <= 0){
if(start.timer) window.clearTimeout(start.timer);
callback && callback();
}
});
}
var next = function(callback){
var newInd = defaultInd + 1;
if(newInd >= list.length){
newInd = 0;
}
change(newInd, callback);
}
var start = function(){
if(start.timer) window.clearTimeout(start.timer);
start.timer = window.setTimeout(function(){
next(function(){
start();
});
}, 8000);
}
start();
$('#js_ban_button_box').on('click', 'a', function(){
var btn = $(this);
if(btn.hasClass('right')){
//next
next(function(){
start();
});
}
else{
//prev
var newInd = defaultInd - 1;
if(newInd < 0){
newInd = list.length - 1;
}
change(newInd, function(){
start();
});
}
return false;
});
})();
</script>
<div class="container">
<div class="register-box">
<div class="reg-slogan"> <font size="5" face="微软雅黑" >用户登录</font> </div>
<div class="reg-form" id="js-form-mobile"><br>
<div class="cell">
<input type="text" name="mobile" id="js-mobile_ipt" class="text" maxlength="11" placeholder="请输入账号" />
</div>
<div class="cell">
<input type="password" name="passwd" id="js-mobile_pwd_ipt" class="text" placeholder="您的密码"/>
<input type="text" name="passwd" id="js-mobile_pwd_ipt_txt" class="text" maxlength="20" style="display:none;" />
</div>
<div class="cell">
<label for="js-mobile_ipt">请输入账号</label>
<input type="text" name="mobile" id="js-mobile_ipt" class="text" maxlength="11" />
</div>
<div class="bottom"><a id="js-mail_btn" href="javascript:;" class="button btn-green">立即注册</a></div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="con">
<div class="copy-right">
<div class="cell">
<div style="width:960px;margin:10px auto; clear:both; text-align:center; ">
<script src="/statics/js/ad/96090.js" type="text/javascript"></script>
</div>
<div style="width:960px;margin:20px auto 100px auto; clear:both; text-align:center; font-size:12px; line-height:25px; ">
<p> </p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,175 @@
<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=7;IE=9;IE=10" />
<link href="/Public/css/home.css?v=2" rel="stylesheet" type="text/css" />
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" rel="stylesheet" />
<script src="//cdn.bootcss.com/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title>魔方 - 我的世界</title>
</head>
<body>
<div class="header">
<div class="con">
<h1 class="logo">Mc魔方联机</h1>
</div>
</div>
<div class="wrap">
<div class="banner-show" id="js_ban_content">
<div class="cell bns-01">
<div class="con"></div>
</div>
<div class="cell bns-02" style="display: none;">
<div class="con"></div>
</div>
<div class="cell bns-03" style="display: none;">
<div class="con"></div>
</div>
</div>
<div class="banner-control" id="js_ban_button_box">
<a href="javascript:;" class="left"></a> <a href="javascript:;"
class="right"></a>
</div>
<div class="container">
<div class="register-box">
<div class="reg-slogan">
<font size="5" face="微软雅黑">用户登录</font>
</div>
<form class="form-horizontal" action="<?php echo U('User/Login');?>" role="form" method="post">
<div class="form-group">
<label for="username" class="col-sm-offset-1 col-sm-3 control-label">用户名:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="username" name="username" placeholder="用户名" required />
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-offset-1 col-sm-3 control-label"> &nbsp; &nbsp;:</label>
<div class="col-sm-6">
<input type="password" class="form-control" id="password" name="password" placeholder="密码" required />
</div>
</div>
<div class="form-group">
<label for="verify" class="col-sm-offset-1 col-sm-3 control-label">验证码:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="verify" name="verify" placeholder="验证码" required />
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-offset-1 col-sm-3 control-label"></label>
<div class="col-sm-6">
<img src="<?php echo U('Common/Verify');?>" class="verifyimg reloadverify" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-7">
<button id="submit" type="button" class="btn btn-primary btn-login">登陆</button>
</div>
</div>
<div class="form-group">
<p class="check-tips text-danger col-sm-offset-3 col-sm-7"></p>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#submit").click(function() {
var user = $("#username").val();
var pass = $("#password").val();
var verify = $("#verify").val();
if (user == "") {
alert("用户名不能为空!");
return;
}
if (pass == "") {
alert("密码不能为空!");
return;
}
$.ajax({
type : "POST",
data : {
username : user,
password : pass,
verify : verify
},
dataType : "json",
url : "<?php echo U('User/Login');?>",
success : function(rdata) {
alert(rdata.info);
window.location.href = rdata.url;
}
});
});
});
</script>
</div>
<script type="text/javascript">
(function() {
var defaultInd = 0;
var list = $('#js_ban_content').children();
var count = 0;
var change = function(newInd, callback) {
if (count)
return;
count = 2;
$(list[defaultInd]).fadeOut(400, function() {
count--;
if (count <= 0) {
if (start.timer)
window.clearTimeout(start.timer);
callback && callback();
}
});
$(list[newInd]).fadeIn(400, function() {
defaultInd = newInd;
count--;
if (count <= 0) {
if (start.timer)
window.clearTimeout(start.timer);
callback && callback();
}
});
}
var next = function(callback) {
var newInd = defaultInd + 1;
if (newInd >= list.length) {
newInd = 0;
}
change(newInd, callback);
}
var start = function() {
if (start.timer)
window.clearTimeout(start.timer);
start.timer = window.setTimeout(function() {
next(function() {
start();
});
}, 8000);
}
start();
$('#js_ban_button_box').on('click', 'a', function() {
var btn = $(this);
if (btn.hasClass('right')) {
//next
next(function() {
start();
});
} else {
//prev
var newInd = defaultInd - 1;
if (newInd < 0) {
newInd = list.length - 1;
}
change(newInd, function() {
start();
});
}
return false;
});
})();
</script>
</body>
</html>

View File

@ -0,0 +1,45 @@
<?php if (!defined('THINK_PATH')) exit(); if(C('LAYOUT_ON')) { echo ''; } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>跳转提示</title>
<style type="text/css">
*{ padding: 0; margin: 0; }
body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }
.system-message{ padding: 24px 48px; }
.system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }
.system-message .jump{ padding-top: 10px}
.system-message .jump a{ color: #333;}
.system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px }
.system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none}
</style>
</head>
<body>
<div class="system-message">
<?php if(isset($message)) {?>
<h1>:)</h1>
<p class="success"><?php echo($message); ?></p>
<?php }else{?>
<h1>:(</h1>
<p class="error"><?php echo($error); ?></p>
<?php }?>
<p class="detail"></p>
<p class="jump">
页面自动 <a id="href" href="<?php echo($jumpUrl); ?>">跳转</a> 等待时间: <b id="wait"><?php echo($waitSecond); ?></b>
</p>
</div>
<script type="text/javascript">
(function(){
var wait = document.getElementById('wait'),href = document.getElementById('href').href;
var interval = setInterval(function(){
var time = --wait.innerHTML;
if(time <= 0) {
location.href = href;
clearInterval(interval);
};
}, 1000);
})();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long