Skip to content

Commit

Permalink
登录、注册、自动登录好了
Browse files Browse the repository at this point in the history
  • Loading branch information
duanyong committed Oct 4, 2012
1 parent ff5503f commit a98cdfe
Show file tree
Hide file tree
Showing 20 changed files with 364 additions and 302 deletions.
1 change: 1 addition & 0 deletions css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ table {

color: #333;
float: right;
margin-right: 15px;

font-size: 14px;
text-align: center;
Expand Down
12 changes: 12 additions & 0 deletions css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#login_slider {
width: 500px;
height: 310px;
background-color: #3E4243;
}

#login_container {
width: 380px;
height: 240px;
margin-top: 100px;
}

11 changes: 11 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#reg_slider {
width: 500px;
height: 310px;
background-color: #3E4243;
}

#reg_container {
width: 380px;
height: 240px;
margin-top: 70px;
}
8 changes: 8 additions & 0 deletions dev/conf/fastcgi_params
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,13 @@ fastcgi_param SINASRV_DB4_PORT_R 3306;
fastcgi_param SINASRV_DB4_NAME_R test;


fastcgi_param SINASRV_CACHE_DIR "/tmp/";
fastcgi_param SINASRV_CACHE_URL "http://all.vic.sina.con.cn/cache";

fastcgi_param SINASRV_MEMCACHED_SERVERS 127.0.0.1:11211;
fastcgi_param SINASRV_GLOBAL_MEMCACHED_SERVERS 127.0.0.1:11211;
fastcgi_param SINASRV_MEMCACHED_KEY_PREFIX "_sing_";


# PHP only, required if PHP was built with --enable-force-cgi-redirect
# fastcgi_param REDIRECT_STATUS 200;
126 changes: 0 additions & 126 deletions dev/devinc.password.php

This file was deleted.

2 changes: 2 additions & 0 deletions footer.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div id="footer">
</div>
22 changes: 22 additions & 0 deletions header.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div id="header">
<div id="logo">
<a title="爱语记">
<img src="img/logo.png" />
<a target="_blank" href="about.html">关于我</a>
</a>
</div>

<div id="user" style="display: {if empty($user)}none{/if};">
<label>{$user.username}</label>
<div id="u_cnt">
<a target="_blank" data-label="查看总数" href="/mine?type=played">累积收听<span id="rec_played">5206</span>首</a>
<a target="_blank" data-label="记录总数" href="/mine?type=played">累积收听<span id="rec_played">5206</span>首</a>
<a target="_blank" data-label="关闭总数" href="/mine?type=played">累积收听<span id="rec_played">5206</span>首</a>
</div>
</div>

<div id="anony" style="display: {if !empty($user)}none{/if};">
<a href="/login.php?back={$back}" onclick="s_ga_click('main_login');">登录</a>
<a href="/reg.php?back={$back}" onclick="s_ga_click('main_reg');">现在注册</a>
</div>
</div>
22 changes: 22 additions & 0 deletions js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//用户登录
function s_login_check() {
var form, username, password;

if (!( username = $('#username').val() )) {
return $('#username').wrong();
}

if (!( password = $('#password').val() )) {
return $('#password').wrong('请输入您的登录密码');
}

return true;
}



$(function() {
$('#login_form').human();
$('#login_submit').on('click', s_login_check);
});

75 changes: 0 additions & 75 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,78 +1,3 @@
//检查用户的账号及昵称是否注册
function s_reg_has() {
if ($('#rnickname').val()
|| $('#rusername').val()
) {
//查看服务器是否已注册
$.getJSON('has.php', $("#reg_form").serialize(), function(ret) {
if (ret.username) {
return $('#rusername').wrong('您的账号已被注册');
}

if (ret.nickname) {
return $('#rusername').wrong('您的昵称已被注册');
}
});
}
}


//提交用户注册信息
function s_reg_check() {

if (!$('#rusername').val()) {
return $('#rusername').wrong('您可以用邮箱或者手机号来登录');
}

if (!$('#rpassword').val()) {
return $('#rpassword').wrong('为了您账号的安全请输入密码');
}

if (!$('#rnickname').val()) {
return $('#rnickname').wrong();
}


return true;
}


//用户登录
function s_login_check() {
var form, username, password;

if (!( username = $('#username').val() )) {
return $('#username').wrong();
}

if (!( password = $('#password').val() )) {
return $('#password').wrong('请输入您的登录密码');
}

return true;
}



$(function() {
$('#reg_form').human();
$('#login_form').human();

$('#btn_nav_login').on('click', function() {
$("#login_dialog").pop();
});

$('#login_submit').on('click', s_login_check);


$('#btn_nav_reg').on('click', function() {
$("#reg_dialog").pop();
});

$('#reg_submit').on('click', s_reg_check);

//检查用户账号及用户昵称
$('#rusername').on('blur', s_reg_has);
//$('#rnickname').on('blur', s_reg_has);

});
45 changes: 45 additions & 0 deletions js/reg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//检查用户的账号及昵称是否注册
function s_reg_has() {
if ($('#rnickname').val()
|| $('#rusername').val()
) {
//查看服务器是否已注册
$.getJSON('has.php', $("#reg_form").serialize(), function(ret) {
if (ret.username) {
return $('#rusername').wrong('您的账号已被注册');
}

if (ret.nickname) {
return $('#rusername').wrong('您的昵称已被注册');
}
});
}
}


//提交用户注册信息
function s_reg_check() {
var ret = true;

if (!$('#username').val()) {
ret = $('#username').wrong('您可以用邮箱或者手机号来登录');
}

if (!$('#password').val()) {
ret = $('#password').wrong('请输入5位以上的密码');
}

if (!$('#nickname').val()) {
ret = $('#nickname').wrong();
}

return ret;
}

$(function() {
$('#reg_submit').on('click', s_reg_check);

//检查用户账号及用户昵称
$('#username').on('blur', s_reg_has);
$('#nickname').on('blur', s_reg_has);
});
Loading

0 comments on commit a98cdfe

Please sign in to comment.