|
@@ -1,23 +1,15 @@
|
|
|
<?php
|
|
|
+
|
|
|
session_start();
|
|
|
-/*
|
|
|
- * To change this license header, choose License Headers in Project Properties.
|
|
|
- * To change this template file, choose Tools | Templates
|
|
|
- * and open the template in the editor.
|
|
|
- */
|
|
|
-include_once dirname(__FILE__).'/../main.php';
|
|
|
-/**
|
|
|
- * Description of login
|
|
|
- * 登录页面业务逻辑
|
|
|
- * @author jgao
|
|
|
- */
|
|
|
+
|
|
|
+include_once dirname(__FILE__) . '/../main.php';
|
|
|
|
|
|
$paras = query_paras();
|
|
|
$username = $paras["username"];
|
|
|
$password = $paras["password"];
|
|
|
|
|
|
|
|
|
-if($username == "admin" && $password == "123456"){
|
|
|
+if ($username == "admin" && $password == "123456") {
|
|
|
// 同时写入cookie和session,用作后续前后端身份验证判定
|
|
|
setcookie("account", $username, time() + 3600, "/");
|
|
|
$_SESSION["account"] = $username;
|
|
@@ -25,7 +17,7 @@ if($username == "admin" && $password == "123456"){
|
|
|
header("Location:" . getPageUrl("index"));
|
|
|
// 确保重定向后,后续代码不会被执行
|
|
|
exit;
|
|
|
-}else{
|
|
|
+} else {
|
|
|
// 否则认为是非法请求
|
|
|
header("Location:" . getPageUrl("err"));
|
|
|
// 确保重定向后,后续代码不会被执行
|