mirror of
https://e.coding.net/circlecloud/McAccount.git
synced 2025-09-05 07:27:21 +00:00
init project...
This commit is contained in:
37
Controller/index.php
Normal file
37
Controller/index.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class index extends AmysqlController
|
||||
{
|
||||
// 默认首页
|
||||
function IndexAction()
|
||||
{
|
||||
$this -> title = 'Minecraft 用户中心'; // 直接赋值模板
|
||||
$this -> _view('message'); // 载入index模板
|
||||
}
|
||||
|
||||
function login(){
|
||||
$this -> title = "Minecraft 用户登陆";
|
||||
|
||||
$this -> _view('login');
|
||||
|
||||
}
|
||||
function register(){
|
||||
$this -> title = "Minecraft 帐号注册";
|
||||
$this -> _view("register");
|
||||
}
|
||||
|
||||
function pass(){
|
||||
$this -> title = "Minecraft 修改密码";
|
||||
$this -> _view("password");
|
||||
}
|
||||
|
||||
function mail(){
|
||||
$this -> title = "Minecraft 邮箱验证";
|
||||
$this -> _View("mail/mailstatus");
|
||||
}
|
||||
function forge(){
|
||||
$this -> title = "Minecraft 密码找回";
|
||||
$this -> _View("forge");
|
||||
}
|
||||
|
||||
}
|
45
Controller/mail_status.php
Normal file
45
Controller/mail_status.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
class mail_status extends AmysqlController
|
||||
{
|
||||
|
||||
function select()
|
||||
{
|
||||
JsonSuccess( $this -> _model("mail_model") -> select(@$_SESSION['username']));
|
||||
}
|
||||
/**
|
||||
* 邮件发送
|
||||
*/
|
||||
function sendmail()
|
||||
{
|
||||
$verify = md5(hash("sha256",@$_REQUEST['mail'].$_REQUEST['user']));
|
||||
$send = mailsender($_REQUEST['mail'], $verify, $_REQUEST['type']);
|
||||
if($send)
|
||||
{
|
||||
$_SESSION['verify'] = $verify;
|
||||
JsonSuccess("邮件发送成功 收到后请填入验证码进行邮箱验证");
|
||||
}else{
|
||||
JsonError("邮件发送失败");
|
||||
}
|
||||
|
||||
}
|
||||
function mail(){
|
||||
$verify = $_SESSION['verify'];
|
||||
|
||||
if(@$_REQUEST['verify'] != $verify)
|
||||
{
|
||||
JsonError('验证码不对!请重试');
|
||||
exit(0);
|
||||
}
|
||||
if($this -> _model("mail_model") -> mail(@$_REQUEST['mail'], $verify, @$_SESSION['username']))
|
||||
JsonSuccess('验证成功');
|
||||
JsonError("验证失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示邮箱验证状态
|
||||
*/
|
||||
function stat(){
|
||||
JsonSuccess($this -> _model('mail_model') -> status(@$_SESSION['username']));
|
||||
}
|
||||
}
|
||||
?>
|
34
Controller/retrieve.php
Normal file
34
Controller/retrieve.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class retrieve extends AmysqlController
|
||||
{
|
||||
function checkmail()
|
||||
{
|
||||
if($this -> _model('mail') -> check($_REQUEST['mail']))
|
||||
JsonSuccess($this -> _model('mail') -> check($_REQUEST['mail']));
|
||||
JsonError("查询失败");
|
||||
}
|
||||
|
||||
function send()
|
||||
{
|
||||
$time = date("Y-m-d");
|
||||
$code = base64_encode($_REQUEST['mail'].":".$time);
|
||||
if(mailsender(@$_REQUEST['mail'],$code,"forget"))
|
||||
$_SESSION['code'] = $code;
|
||||
JsonSuccess("验证邮件已经发送");
|
||||
JsonError("验证邮件发送失败");
|
||||
}
|
||||
|
||||
function status()
|
||||
{
|
||||
$code = base64_decode($_SESSION['code']);
|
||||
$str = explode(":", $code);
|
||||
if($_REQUEST['mail'] !== $str[0])
|
||||
JsonError("邮箱不相同 验证失败");
|
||||
iF($str[1] !== date("Y-m-d"))
|
||||
JsonError('验证日期已过期');
|
||||
if($_REQUEST['key'] !== $_SESSION['code'])
|
||||
JsonError("验证失败");
|
||||
JsonSuccess("验证成功");
|
||||
|
||||
}
|
||||
}
|
12
Controller/user_current.php
Normal file
12
Controller/user_current.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class user_current extends AmysqlController
|
||||
{
|
||||
function current()
|
||||
{
|
||||
$money = $this -> _model('current_model') -> money_current($_REQUEST['user']);
|
||||
|
||||
JsonSuccess( $money );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
51
Controller/user_public.php
Normal file
51
Controller/user_public.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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' ) );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user