手机官网-手机注册与账号注册修改,昵称自动生成

master
“用lww 5 years ago
parent ff976bb9eb
commit c1b5569213

@ -307,13 +307,35 @@ class UserController extends BaseController
*/
public function register()
{
$safeinfo = session('safeinfo');
if ($safeinfo['status'] == 1) {
// $safeinfo = session('safeinfo');
// if ($safeinfo['status'] == 1) {
if (IS_POST) {
$post = I('post.');
$account = $post['phone'];
$password = $post['password'];
$sex = isset($post['sex']) ? $post['sex'] : 0;
if (empty($account)) {
echo json_encode(array('status' => 0, 'msg' => '请输入手机号'));
exit;
}
if (empty($password)) {
echo json_encode(array('status' => 0, 'msg' => '请输入密码'));
exit;
}
$promoteId = I('post.promote_id');
$promoteId = intval($promoteId);
if ($promoteId > 0) {
$gameId = intval(I('post.game_id'));
$safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex, 'status' => 1, 'promote_id' => $promoteId, 'game_id' => $gameId);
} else {
$safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex, 'status' => 1);
}
$phone = $post['phone'];
$safecode = $post['code'];
$nickname = $safeinfo['nickname'];
$nickname = 'U_' . substr($safeinfo['nickname'],-4);
$password = $safeinfo['password'];
$sex = $safeinfo['sex'];
@ -423,9 +445,9 @@ class UserController extends BaseController
$this->assign('url', $url);
$this->display();
}
} else {
$this->redirect(U('step'));
}
// } else {
// $this->redirect(U('step'));
// }
}
/**
@ -438,7 +460,8 @@ class UserController extends BaseController
if (IS_POST) {
$post = I('post.');
$account = $post['account'];
$nickname = $post['nickname'];
// $nickname = $post['nickname'];
$nickname = 'U_' . substr($account,-4);;
$password = $post['password'];
$sex = $post['sex'];

@ -31,7 +31,7 @@
<if condition="I('get.pid') gt 0">
<div class="promptly">还没有账号?<a style="margin-left: 10px;" href="<?='mobile.php?s=/User/step1/pid/'.I('get.pid').'/gid/'.I('get.gid').'.html'?>"> 账号注册 </a>|<a href="<?='mobile.php?s=/User/step/pid/'.I('get.pid').'/gid/'.I('get.gid').'.html'?>"> 手机注册 </a></div>
<else/>
<div class="promptly">还没有账号?<a style="margin-left: 10px;" href="{:U('User/step1')}"> 账号注册 </a>|<a href="{:U('User/step')}"> 手机注册 </a></div>
<div class="promptly">还没有账号?<a style="margin-left: 10px;" href="{:U('User/step1')}"> 账号注册 </a>|<a href="{:U('User/register')}"> 手机注册 </a></div>
</if>
</div>
</div>

@ -28,11 +28,16 @@
<div class="subpage-heard">手机注册
<a href="javascript:window.history.go(-1);" class="arrows"></a>
</div>
<div class="login-box">
<div class="login-input">
<img src="__IMG__/user/shouji.png" alt="">
<input type="text" id="mobile" placeholder="请输入手机号">
</div>
<div class="login-input">
<img src="__IMG__/user/suo.png" alt="">
<input id="password" type="password" placeholder="请输入密码">
</div>
<div class="login-code">
<input id="code" type="text" placeholder="输入验证码">
<div class="jsgetcode">获取验证码</div>
@ -85,12 +90,19 @@
$('.submit').click(function(event) {
var mobile = $.trim($('#mobile').val());
var code = $.trim($('#code').val());
var password = $.trim($('#password').val());
var promoteId = parseInt("{:I('get.pid')}") ? parseInt("{:I('get.pid')}") : 0;
var gameId = parseInt("{:I('get.gid')}") ? parseInt("{:I('get.gid')}") : 0;
if(password.length == 0){
pmsg.msg('密码不能为空');event.preventDefault();
return false;
}
if (mobile) {
if (code) {
$.ajax({
type:'POST',
url:'{:U("register")}',
data:{'phone':mobile,'code':code},
data:{'phone':mobile,'code':code,'password':password,'promote_id':promoteId,'game_id':gameId},
dataType:"Json",
success:function(data){
if(data.status == 1){

@ -28,10 +28,10 @@
<img src="__IMG__/new/suo.png" alt="">
<input type="password" placeholder="请输入密码" name="password" id="password" value="">
</div>
<div class="login-input">
<!--<div class="login-input">
<img src="__IMG__/new/nicheng.png" alt="">
<input type="text" placeholder="请输入昵称" name="nickname" id="nickname" value="">
</div>
</div>-->
<!-- <div class="login-gender">
<div class="title">
<img src="__IMG__/new/xingbie.png" alt="">
@ -81,10 +81,10 @@
pmsg.msg('账号不能为空');event.preventDefault();
return false;
}
if(nickname.length == 0 ){
/*if(nickname.length == 0 ){
pmsg.msg('昵称不能为空');event.preventDefault();
return false;
}
}*/
if(password.length == 0){
pmsg.msg('密码不能为空');event.preventDefault();
return false;

Loading…
Cancel
Save