當(dāng)前位置: 首頁IT技術(shù) → ASP解決網(wǎng)頁保密問題

ASP解決網(wǎng)頁保密問題

更多

本文提供了兩種利用ASP實現(xiàn)網(wǎng)頁保密的方法,正在做網(wǎng)站的朋友可以參考參考。

在維護(hù)公司內(nèi)部網(wǎng)站時碰到一個實際問題——MIS主管要求將一些技術(shù)文件放在網(wǎng)頁上,且只能讓MIS 的員工瀏覽。這就涉及到如何對網(wǎng)頁保密的問題。

    最初我借助Frontpage和VBscript設(shè)計了一種方案,鏈接MIS技術(shù)頁(此處預(yù)設(shè)為tpwdrst.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(“ 密 碼 錯 誤_
  ”,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,根本就不需要通過actpwd.htm 就可直接鏈接actpwdrst.htm。所以這種方案的保密系數(shù)就不是很好。

  下面看看采用ASP設(shè)計的方案。鏈接MIS技術(shù)頁(此處預(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 > 請 輸 入 正 確 的 用 戶 名 和 密 碼
  < /strong >< /font >< /p >
  < /body >
  < % end if % >
  < /html >

  在這個方案里asppwd.asp只提供輸入的功能,而名稱和密碼的確認(rèn)工作由asppwdrst.asp來做。這樣即使 您記住了asppwdrst.asp所在的URL,也看不到具體的內(nèi)容。所以用這種方案設(shè)計的網(wǎng)頁保密系數(shù)就很高。

熱門評論
最新評論
發(fā)表評論 查看所有評論(0)
昵稱:
表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
字?jǐn)?shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)