| 第一個檔案:a.htm <form action='b.php' method=post> 您的身份是 <select name='UserGroup'> <option>訪客 <option>會員 <option>管理者 </select> <input type=submit value='確定'> </form> |
| 第二個檔案:b.php <?php $Item = array( array("News.php", "最新消息", "全部人都可以看", 0), array("User.php", "修改資料", "會員或管理員才能修改", 1), array("Admin.php", "管理網站", "只有管理者才能執行", 2)); switch($UserGroup) { case "管理者": $Purview = 2; break; case "會員": $Purview = 1; break; default: $Purview = 0; } while (list($K, $V) = each($Item)) { if ($Purview >= $Item[$K][3]) { echo "<a href='".$Item[$K][0]."'>".$Item[$K][1]."</a> "; echo $Item[$K][2]."<br>\n"; } } ?> |
說明:
|
| 歡迎光臨 中央論壇 - CENTER BBS (https://mail.centerbbs.com/) | Powered by Discuz! X3 |