diff --git a/index.php b/index.php index 18b50261..cdf7ba32 100755 --- a/index.php +++ b/index.php @@ -3,9 +3,8 @@ * @Author: printempw * @Date: 2016-01-17 13:55:20 * @Last Modified by: prpr - * @Last Modified time: 2016-01-22 14:42:56 + * @Last Modified time: 2016-01-22 16:17:40 */ - $dir = dirname(__FILE__); function __autoload($classname) { @@ -31,5 +30,119 @@ if ($_GET['action'] == "get") { utils::raise(1, 'Illegal parameters.'); } } else { - include("$dir/templates/index.inc.php"); -} + session_start(); + if (utils::getValue('uname', $_COOKIE) && utils::getValue('token', $_COOKIE)) { + $user = new user($_COOKIE['uname']); + if ($_COOKIE['token'] == $user -> getToken()) { + $_SESSION['uname'] = $_COOKIE['uname']; + $_SESSION['token'] = $user -> getToken(); + } + } +/** + * 越写越像 MVC 。。。路由了以后就不得不视图层分离了啊。。等有时间用模板吧 + * + * 这个入口也是神 TM 丑(扶额 + */ +?> + + +
+ + +