1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2024-11-22 01:48:55 +00:00
McAccount/Controller/user_public.php
502647092 da6ef10111 添加用户检测 和用户登录 登出...
Signed-off-by: 502647092 <jtb1@163.com>
2015-11-09 20:54:43 +08:00

67 lines
2.3 KiB
PHP

<?php
class user_public extends AmysqlController {
function register() {
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'];
JsonSuccess ( '登陆成功!' );
} else {
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 ( '离线失败!' );
}
}
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' ) );
}
}
?>