mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2024-11-22 01:48:55 +00:00
update user register...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
a8b45f0800
commit
056187c79f
@ -60,7 +60,7 @@ function RandSting($l = 10) {
|
|||||||
*/
|
*/
|
||||||
function Json($data) {
|
function Json($data) {
|
||||||
header ( 'Content-Type:application/json; charset=' . Config ( 'Charset' ) );
|
header ( 'Content-Type:application/json; charset=' . Config ( 'Charset' ) );
|
||||||
exit ( json_encode ( $data, 0 ) );
|
exit ( json_encode ( $data ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
class user_public extends AmysqlController {
|
class user_public extends AmysqlController {
|
||||||
function register() {
|
function register() {
|
||||||
if ($this->_model ( "authme" )->register ( $_REQUEST ['user'], md5 ( $_REQUEST ['pass'] ), $_REQUEST ['mail'], GetUserIP () ))
|
if ($this->_model ( "authme" )->register ( $_REQUEST ['user'], md5 ( $_REQUEST ['pass'] ), $_REQUEST ['mail'], GetUserIP () )){
|
||||||
$_SESSION ['username'] = $_REQUEST ['user'];
|
$_SESSION ['username'] = $_REQUEST ['user'];
|
||||||
$_SESSION ['mail'] = $_REQUEST ['mail'];
|
$_SESSION ['mail'] = $_REQUEST ['mail'];
|
||||||
$_SESSION ['ip'] = GetUserIP ();
|
$_SESSION ['ip'] = GetUserIP ();
|
||||||
JsonSuccess ( 'Minecraft帐号注册成功' );
|
JsonSuccess ( 'Minecraft帐号注册成功' );
|
||||||
|
}else{
|
||||||
JsonError ( 'Minecraft帐号注册失败' );
|
JsonError ( 'Minecraft帐号注册失败' );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function login() {
|
function login() {
|
||||||
if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
||||||
$_SESSION ['username'] = @$_REQUEST ['user'];
|
$_SESSION ['username'] = @$_REQUEST ['user'];
|
||||||
|
@ -24,7 +24,6 @@ class authme extends AmysqlModel {
|
|||||||
'time' => date ( 'Y-m-d' ),
|
'time' => date ( 'Y-m-d' ),
|
||||||
"user" => $username
|
"user" => $username
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->_insert ( 'authme', $value ) == 0) {
|
if ($this->_insert ( 'authme', $value ) == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -40,7 +39,7 @@ class authme extends AmysqlModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function login($username, $password) {
|
public function login($username, $password) {
|
||||||
if ($this->_sum ( "select * from `authme` where `username` = '$username' and `password` = '$password'" ) == 0)
|
if ($this->_sum ( "SELECT * FROM `authme` WHERE `username` = '$username' AND `password` = '$password'" ) == 0)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@ -51,7 +50,7 @@ class authme extends AmysqlModel {
|
|||||||
"password" => $newpass
|
"password" => $newpass
|
||||||
);
|
);
|
||||||
|
|
||||||
$num = $this->_update ( 'authme', $key, "where username='" . $username . "'" );
|
$num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" );
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
@ -60,14 +59,14 @@ class authme extends AmysqlModel {
|
|||||||
$key = array (
|
$key = array (
|
||||||
"password" => $value
|
"password" => $value
|
||||||
);
|
);
|
||||||
$num = $this->_update ( 'authme', $key, "where username='" . $username . "'" );
|
$num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" );
|
||||||
// print_r($key);
|
// print_r($key);
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public function check_user($user) {
|
public function check_user($user) {
|
||||||
$sum = $this->_sum ( "select * from `authme` where `username` = '" . $user . "'" );
|
$sum = $this->_sum ( "SELECT * FROM `authme` WHERE `username` = '" . $user . "'" );
|
||||||
if ($sum == 0)
|
if ($sum == 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -106,7 +106,6 @@ $("#register").click(function(){
|
|||||||
}
|
}
|
||||||
$.ajax({ url:"<?=Url('user_public','user_check')?>", type:"GET", data:{user:username.val()}, dataType:"json",
|
$.ajax({ url:"<?=Url('user_public','user_check')?>", type:"GET", data:{user:username.val()}, dataType:"json",
|
||||||
success:function(rdata){
|
success:function(rdata){
|
||||||
alert("checkusersuccess");
|
|
||||||
switch(rdata.status){
|
switch(rdata.status){
|
||||||
case "success":
|
case "success":
|
||||||
$.ajax({url:"<?=Url('user_public','mail_check')?>", type:"GET", data:{mail:email.val()}, dataType:"json",
|
$.ajax({url:"<?=Url('user_public','mail_check')?>", type:"GET", data:{mail:email.val()}, dataType:"json",
|
||||||
@ -144,8 +143,8 @@ $("#register").click(function(){
|
|||||||
},
|
},
|
||||||
error:function(){
|
error:function(){
|
||||||
alert("checkusererror");
|
alert("checkusererror");
|
||||||
|
}})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user