mirror of
https://e.coding.net/circlecloud/MinecraftAccount.git
synced 2025-11-24 21:26:09 +00:00
25
Application/Home/Controller/CommonController.class.php
Normal file
25
Application/Home/Controller/CommonController.class.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Home\Controller;
|
||||
|
||||
use Think\Controller;
|
||||
|
||||
class CommonController extends Controller {
|
||||
public function Header() {
|
||||
$this->test = 'Header';
|
||||
$this->display ();
|
||||
}
|
||||
public function Master() {
|
||||
$this->test = 'Master';
|
||||
$this->display ();
|
||||
}
|
||||
public function Banner() {
|
||||
$this->test = 'Banner';
|
||||
$this->display ();
|
||||
}
|
||||
public function Verify() {
|
||||
ob_clean ();
|
||||
$Verify = new \Think\Verify ();
|
||||
$Verify->entry ();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,27 @@
|
||||
<?php
|
||||
namespace Home\Controller;
|
||||
use Think\Controller;
|
||||
class IndexController extends Controller {
|
||||
public function index(){
|
||||
$data=M('authme')->select();
|
||||
dump($data);
|
||||
$this->data->$data;
|
||||
$this->display();
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace Home\Controller;
|
||||
|
||||
use Think\Controller;
|
||||
|
||||
class IndexController extends Controller {
|
||||
public function Login($username="", $password="", $verify = null) {
|
||||
if(IS_POST){
|
||||
$User = A ( 'User' );
|
||||
$te = $User->Login ( $username, $password, $verify );
|
||||
dump ( $te );
|
||||
$this->display ();
|
||||
}
|
||||
|
||||
}
|
||||
/* 退出登录 */
|
||||
public function Logout() {
|
||||
if (is_login ()) {
|
||||
session ( 'user', null );
|
||||
session ( '[destroy]' );
|
||||
$this->success ( '退出成功!', U ( 'login' ) );
|
||||
} else {
|
||||
$this->redirect ( 'login' );
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Application/Home/Controller/MailController.class.php
Normal file
16
Application/Home/Controller/MailController.class.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Home\Controller;
|
||||
|
||||
use Think\Controller;
|
||||
|
||||
class MailController extends Controller {
|
||||
public function Check($mail) {
|
||||
$data = M ( 'mail' )->where ( array ('address' => $mail ) )->find ();
|
||||
if ($data == null) {
|
||||
$this->success ( "邮箱未被注册!", '', true );
|
||||
} else {
|
||||
$this->error ( "邮箱已被注册!", '', true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,56 +12,49 @@ class UserController extends Controller {
|
||||
$this->display ();
|
||||
// $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
|
||||
}
|
||||
public function Login($username, $password) {
|
||||
$data = M ( 'authme' )->where ( array (
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
) )->find ();
|
||||
public function Check($username) {
|
||||
$data = M ( 'authme' )->where ( array ('username' => $username ) )->find ();
|
||||
if ($data != null) {
|
||||
$this->ajaxReturn ( array (
|
||||
status => 1,
|
||||
msg => "登录成功!"
|
||||
) );
|
||||
$this->success ( "用户已注册!", '', true );
|
||||
} else {
|
||||
$this->ajaxReturn ( array (
|
||||
status => 0,
|
||||
msg => "登录失败 用户名或密码错误!"
|
||||
) );
|
||||
$this->error ( "用户未注册!", '', true );
|
||||
}
|
||||
}
|
||||
public function Login($username, $password, $verify = null) {
|
||||
$data = M ( 'authme' )->where ( array ('username' => $username,'password' => md5 ( $password ) ) )->find ();
|
||||
if (IS_POST) {
|
||||
/* 检测验证码 */
|
||||
if (! check_verify ( $verify )) {
|
||||
$this->error ( '验证码输入错误!' );
|
||||
}
|
||||
}
|
||||
if ($data != null) {
|
||||
$this->success ( "登录成功!", U ( 'Index/Index' ), true );
|
||||
} else {
|
||||
$this->error ( "登录失败 用户名或密码错误!", U ( 'Index/Login' ), true );
|
||||
}
|
||||
}
|
||||
public function Register($username, $password, $ip = '127.0.0.1', $mail = 'authme@citycraft.cn') {
|
||||
$modelAuthMe = M ( 'authme' );
|
||||
$result = $modelAuthMe->where ( array (
|
||||
username => $username
|
||||
) )->find ();
|
||||
$result = $modelAuthMe->where ( array (username => $username ) )->find ();
|
||||
if ($result != null) {
|
||||
$this->ajaxReturn ( array (
|
||||
status => 0,
|
||||
msg => "注册失败,用户已存在!"
|
||||
) );
|
||||
$this->ajaxReturn ( array (status => "error",msg => "注册失败,用户已存在!" ) );
|
||||
}
|
||||
$value = array (
|
||||
'username' => $username,
|
||||
'password' => $password,
|
||||
'password' => md5 ( $password ),
|
||||
'ip' => $ip,
|
||||
'lastlogin' => '',
|
||||
'x' => '0',
|
||||
'y' => '0',
|
||||
'z' => '0',
|
||||
'world' => 'world',
|
||||
'email' => $mail
|
||||
);
|
||||
'email' => $mail );
|
||||
$result = $modelAuthMe->save ( $value );
|
||||
if ($result) {
|
||||
$this->ajaxReturn ( array (
|
||||
status => 1,
|
||||
msg => "注册成功!"
|
||||
) );
|
||||
$this->ajaxReturn ( array (status => "success",msg => "注册成功!" ) );
|
||||
} else {
|
||||
$this->ajaxReturn ( array (
|
||||
status => 0,
|
||||
msg => "注册失败!"
|
||||
) );
|
||||
$this->ajaxReturn ( array (status => "error",msg => "注册失败!" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user