1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2024-11-17 00:58:57 +00:00
McAccount/Controller/user_public.php
502647092 056187c79f update user register...
Signed-off-by: 502647092 <jtb1@163.com>
2015-10-13 17:09:13 +08:00

53 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帐号注册成功' );
}else{
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' ) );
}
}
?>