- 論壇徽章:
- 0
|
本帖最后由 Tennessee3Waltz 于 2014-03-18 20:51 編輯
hi,
我搜了各種中英文帖子,實(shí)在沒找到解決辦法,只能來此求助大神解答了。我的html頁面由三個(gè)frame組成(據(jù)說這是種很過時(shí)的技術(shù) )。這個(gè)html需要做個(gè)session鑒權(quán),如果是已登錄用戶,則展示該html頁面;如果不是,則跳轉(zhuǎn)到login界面。另外,其中一個(gè)frame里我需要讀session以便顯示"您好,$username"的信息。我發(fā)現(xiàn)我總是做不到當(dāng)用戶未登錄時(shí),讓用戶跳轉(zhuǎn)至login的功能。以下是我的代碼:
html頁面:- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/frameset.dtd">
- <HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>管理員</TITLE>
- <META http-equiv=Content-Type content="text/html; charset=utf-8">
- <META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD><FRAMESET
- frameSpacing=0 rows=80,* frameBorder=0><FRAME name=top
- src="index/YHTop.php" frameBorder=0 noResize
- scrolling=no><FRAMESET frameSpacing=0 frameBorder=0 cols=220,*><FRAME name=menu
- src="index/YHMenu.php" frameBorder=0 noResize><FRAME name=dmMain
- src="index/Admin_main.php"
- frameBorder=0></FRAMESET><NOFRAMES>
- <p>This page requires frames, but your browser does not support them.</p>
- </NOFRAMES></FRAMESET></HTML>
- <?php
- session_start();
- if(!isset($_SESSION['login_user']))
- {
- session_destroy();
- echo "<script> {window.alert('您未登錄,請先登錄');location.href='../login/login.php'} </script>";
- }?>
復(fù)制代碼 顯示“您好,$username”的YHTop.php部分代碼:- <html>
- ...
- <TD height=35 align="right"><A
- target=_top><B><?php session_start();echo $_SESSION['login_user']?>: </B></FONT></A></TD>
- ...
- </html>
復(fù)制代碼 坐等CU大神回復(fù)~ |
|