作者:胡舜良 本 人 在 維 護(hù) 公 司 內(nèi) 部 網(wǎng) 站 時(shí) 碰 到 一 個(gè) 實(shí) 際 問(wèn) 題 — —MIS 主 管 要 求 將 一 些 技 術(shù) 文 件 放 在 網(wǎng) 頁(yè) 上, 且 只 能 讓MIS 的 員 工 瀏 覽。 這 就 涉 及 到 如 何 對(duì) 網(wǎng) 頁(yè) 保 密 的 問(wèn) 題。 最 初 我 借 助Frontpage 和Vbscript 設(shè) 計(jì) 了 一 種 方 案, 鏈 接MIS 技 術(shù) 頁(yè)( 此 處 預(yù) 設(shè) 為actpwdrst.htm) 之 前, 先 鏈 接actpwd.htm 輸 入 名 稱 和 密 碼( 此 處 名 稱 和 密 碼 都 預(yù) 設(shè) 為“mis”), 只 有 正 確 輸 入 后, 才 能 鏈 接 到actpwdrst.htm。 以 下 是 它 們 的 代 碼。 Actpwd.htm 代 碼 如 下: < html > < head > < title > 密 碼< /title > < /head > < body > < form name=“form1” > < input type=“hidden” name=“VTI-GROUP”_ value=“0” > < div align=“center” >< center >< p > 名 稱< input type =“text” name=“T1” size=_“20” > 密 碼< input type =“password” name=“T2”_ size=“20” > < input type=“button” value=“ 確 認(rèn)”_ name=“B1” > < /p >< /center >< /div > < /form > < p > < script language=“vbscript” > < !- sub b1_onclick() if form1.t1.value=“mis” and_ form1.t2.value=“mis” then document.location=_“actpwdrst.htm” else m1=msgbox(“ 密 碼 錯(cuò) 誤_ ”,0+48, “Warring”) end if end sub // -- > < /script > < /p > < /body > < /html > Actpwdrst.htm 代 碼 如 下: < html > < head > < title > 密 碼< /title > < /head > < body > < p align=“center” > < font face=“ 標(biāo) 楷 體” size=“7” color=“0000ff” > < strong > 你 已 成 功 登 錄 ! < /strong > < /font > < /p > < /body < /html > 細(xì) 心 的 朋 友 可 能 已 發(fā) 現(xiàn) 這 種 方 案 的 不 可 靠 性 — — 輸 入 和 判 斷 都 在actpwd.htm 中 完 成, 不 管 輸 入 的 名 稱 和 密 碼 是 不 是 正 確 的, 只 要 記 住 了actpwdrst.htm 所 在 的URL, 根 本 就 不 需 要 通 過(guò)actpwd.htm 就 可 直 接 鏈 接actpwdrst.htm。 所 以 這 種 方 案 的 保 密 系 數(shù) 就 不 是 很 好。 下 面 看 看 采 用 ASP 設(shè) 計(jì) 的 方 案。 鏈 接MIS 技 術(shù) 頁(yè)( 此 處 預(yù) 設(shè) 為 asppwdrst.asp) 之 前, 先 鏈 接asppwd.asp 輸 入 名 稱 和 密 碼( 此 處 名 稱 和 密 碼 都 預(yù) 設(shè) 為“mis”), 只 有 正 確 輸 入 后, 才 能 鏈 接 到asppwdrst.asp。 以 下 是 它 們 的 代 碼。 Asppwd.asp 代 碼 如 下: < html > < body > < form name=“form1” action= “asppwdrst.asp” method_ =“POST” > < input type=“hidden” name= “VTI-GROUP” value=_“0” > < div align=“center” >< center >< p > 名 稱< input type=“text” name=“T1” size=“20” > 密 碼< input type = “password” name=“T2” size=_“20” > < input type=“submit” value= “ 確 認(rèn)” name=_“B1” > < /p >< /center >< /div > < /form > < /body > < /html > Asppwdrst.asp 代 碼 如 下: < html > < % if rtrim(request.form(“t1”))= “mis” and_ rtrim(request.form(“t2”))= “mis” then % > < body > < p align=“center” >< font face= “ 標(biāo) 楷 體” size=“7”_ color=“#0000ff” > < strong > 你 已 成 功 登 錄 ! < /strong >< /font >< /p > < /body > < % else % > < body > < p align=“center” >< font face= “ 標(biāo) 楷 體” size=“7”_ color=“#0000ff” > < strong > 請(qǐng) 輸 入 正 確 的 用 戶 名 和 密 碼 < /strong >< /font >< /p > < /body > < % end if % > < /html > 在 這 個(gè) 方 案 里asppwd.asp 只 提 供 輸 入 的 功 能, 而 名 稱 和 密 碼 的 確 認(rèn) 工 作 由asppwdrst.asp 來(lái) 做。 這 樣 即 使 您 記 住 了asppwdrst.asp 所 在 的URL, 也 看 不 到 具 體 的 內(nèi) 容。 所 以 用 這 種 方 案 設(shè) 計(jì) 的 網(wǎng) 頁(yè) 保 密 系 數(shù) 就 很 高。
|