From 57e925369b087e1153d3c5384c2d06929b5d0d3e Mon Sep 17 00:00:00 2001 From: hhCandy Date: Sun, 30 Dec 2018 14:34:36 +0800 Subject: [PATCH] add reg --- clever-login.css | 2 ++ clever-login.min.js | 84 ++++++++++++++++++++++++++++++++++++++++++++- record_usr.php | 32 ++++++++++++++++- record_usrName.php | 13 +++++++ 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 record_usrName.php diff --git a/clever-login.css b/clever-login.css index 4c0c573..c1cd8e6 100644 --- a/clever-login.css +++ b/clever-login.css @@ -1395,6 +1395,8 @@ input[type=number]::-webkit-outer-spin-button { margin-left: -230px; position: fixed; top: 15%; + z-index: -100; + opacity: 0; } .find_password h4{ font-size: 18px; diff --git a/clever-login.min.js b/clever-login.min.js index 1cc3d23..9391f89 100644 --- a/clever-login.min.js +++ b/clever-login.min.js @@ -13,6 +13,35 @@ var _code=0; $(".log-btn").addClass("off"); +$(".next").addClass("off"); + +function reg() +{ + + $(".login").css({ + "opacity":"0", + "z-index":"-100", + "transition-duration": "1s", + "transition-delay": "0s" + }); + + $(".find_password").css({ + "opacity":"1", + "z-index":"999", + "transition-duration": "1s", + "transition-delay": "0s" + }); +} + + + $('#pc_tel').keyup(function(event) { + if($.trim($('#pc_tel').val()).length>2&&$.trim($('#pc_tel').val()).length<13) $(".next").removeClass("off"); + else $(".next").addClass("off"); + + if($.trim($('#pc_tel').val()).length>12) + $('.pc_tel-err').removeClass('hide').text('最多12个字哦ヽ(•̀ω•́ )ゝ'); + + }); $('#veri-code').keyup(function(event) { @@ -91,14 +120,16 @@ $(".log-btn").addClass("off"); type: 'post', dataType: 'json', async: true, - data: {"tel":g_finalTel,"fp":fp}, + data: {"tel":g_finalTel,"fp":fp,"ip":ip}, success:function(data){ if (data.code == '0') { //正常登录 + alert('normal login'); return true; } else if(data.code=='1'){ //转注册界面 + reg(); } else{ $('.tel-warn').removeClass('hide').text('登录失败'); @@ -114,6 +145,57 @@ $(".log-btn").addClass("off"); } + }); + + + // next点击事件 + $(".next").on("click",function sendBtn(){ + + var name = $.trim($('#pc_tel').val()); + + if(name.length>2&&name.length<13) + { + + $.ajax({ + url: '/etc/clever-login/record_usrName.php', + type: 'post', + dataType: 'json', + async: true, + data: {"tel":g_finalTel,"name":name}, + success:function(data){ + if (data.code == '0') { + //正常登录 + alert('normal login'); + return true; + } + else{ + $('.pc_tel-err').removeClass('hide').text('注册失败啦!!'); + $(".lang-btn").addClass("off"); + } + }, + error:function(){ + alert('嘀~ 与服务器失联啦 ( ´◔‸◔`)'); + } + }); + } + else if(name.length>12) + { + $('.pc_tel-err').removeClass('hide').text('最多12个字哦ヽ(•̀ω•́ )ゝ'); + } + else if(name.length<3) + { + $('.pc_tel-err').removeClass('hide').text('字数有点少哦~'); + } + else + { + $('.pc_tel-err').removeClass('hide').text('未知错误哦~'); + } + + + return false; + + + }); // 登录的回车事件 diff --git a/record_usr.php b/record_usr.php index 65ad9e4..c8b3df8 100644 --- a/record_usr.php +++ b/record_usr.php @@ -1,3 +1,33 @@ 0)); \ No newline at end of file +$tel=$_REQUEST['tel']; +$fp=$_REQUEST['fp']; +$ip=$_REQUEST['ip']; + +$conn=db__connect(); + +if(db__rowNum($conn,"user","tel",$tel)) +{ + echo json_encode(array(code=>0)); + + $result=db__getData($conn,"user","tel",$tel); + + db__pushData($conn,"user",array("count"=>$result[0]['count']+1,"ip"=>$ip),array("tel"=>$tel)); +} +else +{ + echo json_encode(array(code=>1)); + + $result=db__getData($conn,"ssr","port",0); + + $port=$result[0]['passwd']+1; + + db__pushData($conn,"user",array("tel"=>$tel,"time"=>time(),"count"=>1,"ip"=>$ip,"ssr"=>$port)); + + db__pushData($conn,"ssr",array("passwd"=>$port),array("port"=>0)); +} + +db__pushData($conn,"fp",array("usr"=>$tel,"fp"=>$fp),array("fp"=>$fp)); + +die(); \ No newline at end of file diff --git a/record_usrName.php b/record_usrName.php new file mode 100644 index 0000000..55888c0 --- /dev/null +++ b/record_usrName.php @@ -0,0 +1,13 @@ +$name),array("tel"=>$tel)); + +echo json_encode(array("code"=>0)); + +die(); \ No newline at end of file