mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2024-11-25 02:18:57 +00:00
8f27adba84
Signed-off-by: 502647092 <jtb1@163.com>
75 lines
2.6 KiB
PHP
75 lines
2.6 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 clientlogin() {
|
|
if ($this->_model ( "authme" )->clientlogin ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
|
JsonSuccess ( '登陆成功!' );
|
|
} else {
|
|
JsonError ( '登陆失败 用户名或密码错误!' );
|
|
}
|
|
}
|
|
function clientlogout() {
|
|
if ($this->_model ( "authme" )->clientlogout ( @$_REQUEST ['user'])) {
|
|
$_SESSION ['username'] = @$_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' ) );
|
|
}
|
|
}
|
|
|
|
?>
|