mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2024-10-31 22:18:55 +00:00
51 lines
1.9 KiB
PHP
51 lines
1.9 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帐号注册成功' );
|
||
|
JsonError ( 'Minecraft帐号注册失败' );
|
||
|
}
|
||
|
function login() {
|
||
|
if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) {
|
||
|
$_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' ) );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|