推薦:ASP防止GET,Post注入和防止服務器攻擊,並記錄IP % '防止GET,Post注入和防止服務器攻擊'使用方法把本文件包含到需要防注的文件就OK了,說明下,這裡的post攻擊和Get攻擊不一定是攻擊,在英文版本的時候請注意使用'馮旭修改session.Abandon() Dim fxjt111_Attack_post,fxjt111_Attack_Get,fxjt111_Attack_Sys
由於工作關係,在做一個用戶空間。要用到空間的最近訪客,見ASP代碼:
<%
username=request.QueryString(username) '地欄中的username,就是自己的用戶名了
if trim(request.Cookies(user_name))<> Then '首頁要判斷該訪問是否登陸,只有登陸的訪問才能記入數據庫。
if username <> request.Cookies(user_name) Then '判斷該訪客是否是自己
f_username=trim(request.Cookies(user_name)) '獲取訪問的用戶名
f_time=now()
Call Visitor() '調用訪問的函數
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 '判斷是否存在數據庫,如果有更新時間,沒有的話就年插入該訪客的用戶名和時間
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
%>
然後就是自己在空間中調用最近訪問了,代碼省略。
分享:ASP將IP地址最後一位替換成星號實例代碼先將IP地址存入數據庫,然後取出來,效果如圖: 代碼如下: % '來源ipstr= rs(cIP) ipstr=split(ipstr,.,-1,1) ipstrout=ipstr(0).ipstr(1).ipstr(2).* response.write ipstrout %