ASP實例:ASP實現(xiàn)空間的最近訪客_ASP教程
推薦:ASP防止GET,Post注入和防止服務(wù)器攻擊,并記錄IP% '防止GET,Post注入和防止服務(wù)器攻擊 '使用方法把本文件包含到需要防注的文件就OK了,說明下,這里的post攻擊和Get攻擊不一定是攻擊,在英文版本的時候請注意使用 '馮旭修改 session.Abandon() Dim fxjt111_Attack_post,fxjt111_Attack_Get,fxjt111_Attack_Sys
由于工作關(guān)系,在做一個用戶空間。要用到空間的最近訪客,見ASP代碼:
<%
username=request.QueryString("username") '地欄中的username,就是自己的用戶名了
if trim(request.Cookies("user_name"))<>"" Then '首頁要判斷該訪問是否登陸,只有登陸的訪問才能記入數(shù)據(jù)庫。
if username <> request.Cookies("user_name") Then '判斷該訪客是否是自己
f_username=trim(request.Cookies("user_name")) '獲取訪問的用戶名
f_time=now()
Call Visitor() '調(diào)用訪問的函數(shù)
end if
end if
Sub Visitor()
'作者:無情 來源:
sqlVisitor=("select top 1 * from visitor where (username='"&username&"') and (f_username='"&f_username&"') ")
Set rsVisitor=server.CreateObject("adodb.recordset")
rsVisitor.open sqlVisitor,conn,1,1
if not (rsVisitor.eof and rsVisitor.bof) Then '判斷是否存在數(shù)據(jù)庫,如果有更新時間,沒有的話就年插入該訪客的用戶名和時間
conn.execute ("update visitor set f_time ='"&now()&"' where (username='"&username&"') and (f_username='"&f_username&"') ")
Else
conn.execute ("insert into visitor (username,f_username,f_time) values ('"&username&"','"&f_username&"','"&f_time&"')")
end If
rsVisitor.close()
Set rsVisitor=nothing
End Sub
%>
然后就是自己在空間中調(diào)用最近訪問了,代碼省略。
分享:ASP將IP地址最后一位替換成星號實例代碼先將IP地址存入數(shù)據(jù)庫,然后取出來,效果如圖: 代碼如下: % '來源 ipstr= rs(cIP) ipstr=split(ipstr,.,-1,1) ipstrout=ipstr(0).ipstr(1).ipstr(2).* response.write ipstrout %
- asp FSO 讀寫文件本文件實現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫實現(xiàn)代碼
- asp中正則表達(dá)式過濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁模板:ASP內(nèi)建對象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個小技巧
- eWebEditor v3.8 列目錄
- ASP無組件分頁實現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說明:
ASP教程-ASP實例:ASP實現(xiàn)空間的最近訪客
。