1
0
mirror of https://e.coding.net/circlecloud/MinecraftAccount.git synced 2025-11-24 21:26:09 +00:00

移除无用文件 添加用户控制器...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-11-05 20:23:14 +08:00
parent 2003fda7cb
commit 6dd800f2e2
7 changed files with 70 additions and 7 deletions

View File

@@ -4,8 +4,8 @@ use Think\Controller;
class IndexController extends Controller {
public function index(){
$data=M('authme')->select();
dump($data);
$this->data->$data;
$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');
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace Home\Controller;
use Think\Controller;
class UserController extends Controller {
public function index() {
$data = M ( 'authme' )->select ();
dump ( $data );
$this->data->$data;
$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 ();
if ($data != null) {
$this->ajaxReturn ( array (
status => 1,
msg => "登录成功!"
) );
} else {
$this->ajaxReturn ( array (
status => 0,
msg => "登录失败 用户名或密码错误!"
) );
}
}
public function Register($username, $password, $ip = '127.0.0.1', $mail = 'authme@citycraft.cn') {
$modelAuthMe = M ( 'authme' );
$result = $modelAuthMe->where ( array (
username => $username
) )->find ();
if ($result != null) {
$this->ajaxReturn ( array (
status => 0,
msg => "注册失败,用户已存在!"
) );
}
$value = array (
'username' => $username,
'password' => $password,
'ip' => $ip,
'lastlogin' => '',
'x' => '0',
'y' => '0',
'z' => '0',
'world' => 'world',
'email' => $mail
);
$result = $modelAuthMe->save ( $value );
if ($result) {
$this->ajaxReturn ( array (
status => 1,
msg => "注册成功!"
) );
} else {
$this->ajaxReturn ( array (
status => 0,
msg => "注册失败!"
) );
}
}
}