Created
May 15, 2013 14:19
-
-
Save jeremy5189/5584312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/******** 登入畫面 login.php ********/ | |
if(empty($_SESSION['login_success'])) | |
$_SESSION['login_success'] = ""; | |
if( $_SESSION['login_success'] == "true" ) | |
{ | |
header("Location: index.php"); | |
exit(); | |
} | |
/******** 處理登入 login_proc.php ********/ | |
$_SESSION['login_success'] = "true"; | |
/******** 每頁都要 include 的檢查器 ********/ | |
session_start(); | |
if( $_SESSION['login_success'] != "true" || empty($_SESSION['login_success']) ) | |
{ | |
// 取得當前頁面URL | |
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; | |
$nowURL = urldecode($protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); | |
// 傳給login.php | |
header("Location: login.php?ref=$nowURL"); | |
exit(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment