2012-03-14 38 views

回答

3

在/ secret文件夾中,您可以讓索引頁設置會話並從公共區域檢查該文件夾。

例如,在PHP:

/secret/index.php

<?php 
session_start(); 
$_SESSION['htpasswdAuth'] = true; 
header("Location: /public/area"); 
?> 

然後其它腳本可以這樣做:

<?php 
session_start(); 

if(isset($_SESSION['htpasswdAuth']) && $_SESSION['htpasswdAuth'] == true) 
{ 
    echo 'hello authenticated user!'; 
} 
?> 
相關問題