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) {
|
||||
header ( 'Content-Type:application/json; charset=' . Config ( 'Charset' ) );
|
||||
exit ( json_encode ( $data, 0 ) );
|
||||
exit ( json_encode ( $data ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,13 +1,15 @@
|
||||
<?php
|
||||
class user_public extends AmysqlController {
|
||||
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 ['mail'] = $_REQUEST ['mail'];
|
||||
$_SESSION ['ip'] = GetUserIP ();
|
||||
JsonSuccess ( 'Minecraft帐号注册成功' );
|
||||
}else{
|
||||
JsonError ( 'Minecraft帐号注册失败' );
|
||||
}
|
||||
}
|
||||
function login() {
|
||||
if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
||||
$_SESSION ['username'] = @$_REQUEST ['user'];
|
||||
|
@ -24,7 +24,6 @@ class authme extends AmysqlModel {
|
||||
'time' => date ( 'Y-m-d' ),
|
||||
"user" => $username
|
||||
);
|
||||
|
||||
if ($this->_insert ( 'authme', $value ) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
@ -40,7 +39,7 @@ class authme extends AmysqlModel {
|
||||
}
|
||||
}
|
||||
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;
|
||||
else
|
||||
@ -51,7 +50,7 @@ class authme extends AmysqlModel {
|
||||
"password" => $newpass
|
||||
);
|
||||
|
||||
$num = $this->_update ( 'authme', $key, "where username='" . $username . "'" );
|
||||
$num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" );
|
||||
if ($num == 0)
|
||||
return false;
|
||||
return true;
|
||||
@ -60,14 +59,14 @@ class authme extends AmysqlModel {
|
||||
$key = array (
|
||||
"password" => $value
|
||||
);
|
||||
$num = $this->_update ( 'authme', $key, "where username='" . $username . "'" );
|
||||
$num = $this->_update ( 'authme', $key, "WHERE username='" . $username . "'" );
|
||||
// print_r($key);
|
||||
if ($num == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
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)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -106,7 +106,6 @@ $("#register").click(function(){
|
||||
}
|
||||
$.ajax({ url:"<?=Url('user_public','user_check')?>", type:"GET", data:{user:username.val()}, dataType:"json",
|
||||
success:function(rdata){
|
||||
alert("checkusersuccess");
|
||||
switch(rdata.status){
|
||||
case "success":
|
||||
$.ajax({url:"<?=Url('user_public','mail_check')?>", type:"GET", data:{mail:email.val()}, dataType:"json",
|
||||
@ -144,8 +143,8 @@ $("#register").click(function(){
|
||||
},
|
||||
error:function(){
|
||||
alert("checkusererror");
|
||||
}})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user