人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

用ASP為你的網站加密

用ASP為你的網站加密

更新時間:2022-08-02 文章作者:未知 信息來源:網絡 閱讀次數:


正在學習建設web站點的讀者,可能正在為站點的安全性而擔憂;也許你正在建設一個非公開性網站,只有系統用戶才可以訪問你的站點。如果你編制的是ASP網頁,那么你可以通過本文輕松達到這一目的。

首先,你需要制作登錄頁面,在html中加入form,并設為自發送頁

〈form name=″login″ action=″default.ASP″ method=″post″ target=″—top″〉

action后接本頁url,這樣即使用戶登錄錯誤,在本頁即獲提示,而無須再返回前一頁登錄。在表單中加入

〈input name=″uid″ size=″10″maxlength=″10″ style=″height: 21px; width: 101px″〉

〈input name=″pwd″ type=″password″ size=″10″ maxlength=″10″〉  


完成html后,在頁首填加程序代碼如下:

〈% ′send customer direct to main page if already logged in

if not isempty(session(″cust—id″)) and len(session(″cust—id″))〉0 then response.redirect(″navigation/dashbrd.ASP″)

′在此添入你真正的主頁url

end if

′set flags

blogin = false

berror = false

′check blank entries

if isempty(request(″uid″)) or len(request(″uid″)) = 0 or isempty(request(″pwd″)) or len(request(″pwd″)) = 0 then

′need to log in

blogin = true

else

′check user credentials against db

… ′檢驗你的數據庫保存密碼表中是否有該用戶

′此處放入連接數據庫代碼

′其sql如下 ″select * from customer where cust—id=′″ & request(″uid″) & ″′ and ′cust—pwd=′″ & request(″pwd″) & ″′″

′其中request(″uid″)和request(″pwd″) 為本頁html中表單中的用戶名和密碼的text

gbfound = false

if not rscust.bof and not rscust.eof then

gbfound = true

end if

if gbfound then

′record useful customer info in session variables

session(″cust—id″) = rscust.fields(″cust—id″)

′ 此項為數據庫中用戶名

session(″cust—pwd″) = rscust.fields(″cust—pwd″) ′此項為數據庫中用戶密碼

session(″power″) = rscust.fields(″power″) ′此項為數據庫中用戶權限[可選]

′update last login time [可選]

′ rscust.activeconnection.execute (″update customer set cust—login = ′″& now & ″′ where cust_id = ″ & session(″cust—id″) & ″″)

response.redirect(″navigation/dashbrd.ASP″) ′真正主頁url

else

′uid and password not found

berror = true blogin = true

end if

rscust.close

′close recordset

mycn—login.close

set mycn—login=nothing

′get all policy numbers held by customer

end if

%〉

最后,你要做的就是在你的每一個頁面的開頭,加入以下代碼:

〈% if isempty(session(″cust—id″)) or len(trim(session(″cust—id″)) = 0 then %〉

〈script language=″javascript″ runat=client〉

〈!——

top.location.href = ″../default.ASP″

//——〉

〈script〉

〈% response.end

end if %〉  


其中,session(″cust—id″) 為注冊的用戶名。

top.location.href = ″../default.ASP″ 將自動導航到你的登錄界面。

在這樣處理之后,恭喜你,你的web站點就有了安全登錄的功能。即使別人知道了你的站點的地址,在不進行合法登錄的情況下,也無法訪問其他網頁。并且,在你的網頁超時后,需要用戶重新登錄,這樣即便操作者臨時離開,也不必擔心非法者的惡意操作。

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 拉萨市| 泌阳县| 宜宾市| 安义县| 德保县| 文昌市| 贵阳市| 古蔺县| 江门市| 峡江县| 额尔古纳市| 桃园县| 娄底市| 抚州市| 镇远县| 钟祥市| 昌图县| 桑日县| 揭东县| 迁西县| 陆川县| 江北区| 尚义县| 双城市| 恩平市| 苍山县| 酒泉市| 万全县| 宜川县| 大名县| 洱源县| 三都| 呼玛县| 靖州| 固阳县| 江城| 连州市| 河曲县| 嵊泗县| 西盟| 云安县|