From 1a664b41c9be1183a4d705cf6f7c8fdea0dee54c Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 10 Nov 2015 20:28:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E9=99=86=E5=A4=84=E7=90=86=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=A1=B5=E9=9D=A2...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- Controller/index.php | 8 ++++++++ Controller/user_public.php | 16 ++++++++++++---- Model/authme.php | 7 +++++++ View/news.php | 0 View/pics.php | 0 View/study.php | 0 View/tsjs.php | 0 7 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 View/news.php create mode 100644 View/pics.php create mode 100644 View/study.php create mode 100644 View/tsjs.php diff --git a/Controller/index.php b/Controller/index.php index 7d4c4ed..fc94e9b 100644 --- a/Controller/index.php +++ b/Controller/index.php @@ -29,4 +29,12 @@ class index extends AmysqlController { $this->title = "Minecraft 服务器列表"; $this->_View ( "servers" ); } + function news() { + $this->title = "Minecraft 服务器列表"; + $this->_View ( "news" ); + } + function pics() { + $this->title = "Minecraft 服务器列表"; + $this->_View ( "pics" ); + } } \ No newline at end of file diff --git a/Controller/user_public.php b/Controller/user_public.php index 9d3d955..1bfadc7 100644 --- a/Controller/user_public.php +++ b/Controller/user_public.php @@ -25,11 +25,19 @@ class user_public extends AmysqlController { JsonError ( '未通过验证 请T出服务器!' ); } } - function clientlogout() { - if ($this->_model ( "authme" )->clientlogout ( @$_REQUEST ['user'] )) { - JsonSuccess ( '离线成功!' ); + function clientlogin() { + if ($this->_model ( "authme" )->clientlogin ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) { + JsonSuccess ( '登陆成功!' ); } else { - JsonError ( '离线失败!' ); + JsonError ( '登陆失败!' ); + } + } + function clientlogout() { + if ($this->_model ( "authme" )->login ( @$_REQUEST ['user'], md5 ( @$_REQUEST ['pass'] ) )) { + $_SESSION ['username'] = @$_REQUEST ['user']; + JsonSuccess ( '登陆成功!' ); + } else { + JsonError ( '登陆失败!' ); } } function pass() { diff --git a/Model/authme.php b/Model/authme.php index 45a8ce1..b06d0c4 100644 --- a/Model/authme.php +++ b/Model/authme.php @@ -26,6 +26,13 @@ class authme extends AmysqlModel { return true; } } + public function clientlogin($username, $password) { + $sum = $this->_sum ( "SELECT * FROM `authme` WHERE `username` = '$username' AND `password` = '$password'" ); + if ($sum != 0) + return true; + else + return false; + } public function clientcheck($username) { $num = $this->_sum ( "SELECT * FROM `authme` WHERE `username`='$username' AND `isLogged`='1'" ); if ($num != 0) diff --git a/View/news.php b/View/news.php new file mode 100644 index 0000000..e69de29 diff --git a/View/pics.php b/View/pics.php new file mode 100644 index 0000000..e69de29 diff --git a/View/study.php b/View/study.php new file mode 100644 index 0000000..e69de29 diff --git a/View/tsjs.php b/View/tsjs.php new file mode 100644 index 0000000..e69de29