2015-10-13 06:26:47 +00:00
|
|
|
<?php
|
|
|
|
class user_public extends AmysqlController {
|
|
|
|
function register() {
|
2015-10-13 09:09:13 +00:00
|
|
|
if ($this->_model ( "authme" )->register ( $_REQUEST ['user'], md5 ( $_REQUEST ['pass'] ), $_REQUEST ['mail'], GetUserIP () )){
|
2015-10-13 06:26:47 +00:00
|
|
|
$_SESSION ['username'] = $_REQUEST ['user'];
|
2015-10-13 09:09:13 +00:00
|
|
|
$_SESSION ['mail'] = $_REQUEST ['mail'];
|
|
|
|
$_SESSION ['ip'] = GetUserIP ();
|
|
|
|
JsonSuccess ( 'Minecraft帐号注册成功' );
|
|
|
|
}else{
|
|
|
|
JsonError ( 'Minecraft帐号注册失败' );
|
|
|
|
}
|
2015-10-13 06:26:47 +00:00
|
|
|
}
|
|
|
|
function login() {
|
|
|
|
if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
|
|
|
$_SESSION ['username'] = @$_REQUEST ['user'];
|
2015-11-09 12:54:43 +00:00
|
|
|
JsonSuccess ( '登陆成功!' );
|
2015-10-13 06:26:47 +00:00
|
|
|
} else {
|
2015-11-09 12:54:43 +00:00
|
|
|
JsonError ( '登陆失败!' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function clientcheck() {
|
|
|
|
if ($this->_model ( "authme" )->clientcheck ( @$_REQUEST ['user'] )) {
|
|
|
|
JsonSuccess ( '通过验证 允许登录服务器!' );
|
|
|
|
} else {
|
|
|
|
JsonError ( '未通过验证 请T出服务器!' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function clientlogout() {
|
|
|
|
if ($this->_model ( "authme" )->clientlogout ( @$_REQUEST ['user'] )) {
|
|
|
|
JsonSuccess ( '离线成功!' );
|
|
|
|
} else {
|
|
|
|
JsonError ( '离线失败!' );
|
2015-10-13 06:26:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function pass() {
|
|
|
|
if ($this->_model ( "authme" )->pass ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['newpass'] ) )) {
|
|
|
|
$_SESSION ['username'] = "";
|
|
|
|
JsonSuccess ( "密码更改成功 !请重新登陆" );
|
|
|
|
} else {
|
|
|
|
JsonError ( "游戏密码更改失败!请检查原密码是否正确" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function forge() {
|
|
|
|
$forge_mail = mailsender ( $_REQUEST ['mail'], $_REQUEST ['pass'], $_REQUEST ['type'] );
|
|
|
|
if (! $forge_mail)
|
|
|
|
return false;
|
|
|
|
else if ($this->_model ( 'authme' )->pass_forge ( md5 ( $_REQUEST ['pass'] ), $_REQUEST ['user'] ))
|
|
|
|
JsonSuccess ( '新密码已经发送到你的邮箱' );
|
|
|
|
JsonError ( '密码发送失败!无法更换默认密码 !请重试' );
|
|
|
|
}
|
|
|
|
function user_check() {
|
|
|
|
if ($this->_model ( 'authme' )->check_user ( @$_REQUEST ['user'] ))
|
|
|
|
JsonSuccess ( "此帐号可以注册" );
|
|
|
|
JsonError ( "此帐号已存在 请更换" );
|
|
|
|
}
|
|
|
|
function mail_check() {
|
|
|
|
if ($this->_model ( "mail" )->mailcheck ( $_REQUEST ['mail'] ))
|
|
|
|
JsonSuccess ( "此邮箱可以使用" );
|
|
|
|
JsonError ( "该邮箱已被注册!请更换" );
|
|
|
|
}
|
|
|
|
function logout() {
|
|
|
|
session_destroy ();
|
|
|
|
header ( "location:" . Url ( 'index', 'login' ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|