From 6dd800f2e25220b7964daba3e51c0a753cc468a9 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 5 Nov 2015 20:23:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- Application/Common/Common/index.html | 1 - Application/Common/Conf/config.php | 1 - Application/Common/Conf/index.html | 1 - Application/Common/index.html | 1 - Application/Home/Conf/config.php | 4 +- .../Home/Controller/IndexController.class.php | 2 +- .../Home/Controller/UserController.class.php | 67 +++++++++++++++++++ 7 files changed, 70 insertions(+), 7 deletions(-) delete mode 100644 Application/Common/Common/index.html delete mode 100644 Application/Common/Conf/index.html delete mode 100644 Application/Common/index.html create mode 100644 Application/Home/Controller/UserController.class.php diff --git a/Application/Common/Common/index.html b/Application/Common/Common/index.html deleted file mode 100644 index 0519ecb..0000000 --- a/Application/Common/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Application/Common/Conf/config.php b/Application/Common/Conf/config.php index 4a57ea8..69008cd 100644 --- a/Application/Common/Conf/config.php +++ b/Application/Common/Conf/config.php @@ -1,6 +1,5 @@ '配置值' // 添加数据库配置信息 'DB_TYPE' => 'mysql', // 数据库类型 'DB_HOST' => '127.0.0.1', // 服务器地址 diff --git a/Application/Common/Conf/index.html b/Application/Common/Conf/index.html deleted file mode 100644 index 0519ecb..0000000 --- a/Application/Common/Conf/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Application/Common/index.html b/Application/Common/index.html deleted file mode 100644 index 0519ecb..0000000 --- a/Application/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Application/Home/Conf/config.php b/Application/Home/Conf/config.php index 74bc338..7e3997a 100644 --- a/Application/Home/Conf/config.php +++ b/Application/Home/Conf/config.php @@ -4,8 +4,8 @@ return array ( 'DB_TYPE' => 'mysql', // 数据库类型 'DB_HOST' => '127.0.0.1', // 服务器地址 'DB_NAME' => 'minecraft', // 数据库名 - 'DB_USER' => 'minecraft', // 用户名 - 'DB_PWD' => '325325', // 密码 + 'DB_USER' => 'root', // 用户名 + 'DB_PWD' => 'root', // 密码 'DB_PORT' => 3306, // 端口 'DB_PREFIX' => '', // 数据库表前缀 'DB_CHARSET' => 'utf8' diff --git a/Application/Home/Controller/IndexController.class.php b/Application/Home/Controller/IndexController.class.php index a66e027..a8bee21 100644 --- a/Application/Home/Controller/IndexController.class.php +++ b/Application/Home/Controller/IndexController.class.php @@ -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('

:)

欢迎使用 ThinkPHP


版本 V{$Think.version}
','utf-8'); } } \ No newline at end of file diff --git a/Application/Home/Controller/UserController.class.php b/Application/Home/Controller/UserController.class.php new file mode 100644 index 0000000..3c2ff54 --- /dev/null +++ b/Application/Home/Controller/UserController.class.php @@ -0,0 +1,67 @@ +select (); + dump ( $data ); + $this->data->$data; + $this->display (); + // $this->show('

:)

欢迎使用 ThinkPHP


版本 V{$Think.version}
','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 => "注册失败!" + ) ); + } + } +} \ No newline at end of file