校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > 用ASP創建日志文件(附源程序)

用ASP創建日志文件(附源程序)

熱門標簽:世界地圖標注了哪些城市 石家莊慧營銷外呼系統 梧州市地圖標注 濟源電銷外呼系統線路 創意電話機器人 地圖標注陽江 外呼線路批發 武穴地圖標注 java外呼系統是什么
這個例子使用文本文件來寫入用戶的信息創建一個logfile.asp放在每一個asp的頁面的頂端!--#Include File="LogFile.asp"-->當有人來訪問你的站點logfile.asp自動把他的信息寫入LogFile.txt,如果相關的URl一樣的話則不寫入文件
File: LogFile.asp
復制代碼 代碼如下:

%
Dim ValidEntry ' Log variable
' First set that this log is valid
ValidEntry = True

' If Session Variable "LogIn" is not empty
' that mean this person has already been logged
' then set ValidLog to False
If not IsEmpty(Session("LogIn")) then ValidEntry = False

' Here you can add different restriction
' If the refering url is from same site
' don't write to log file
If Left(Request.ServerVariables("HTTP_REFERER"), 17)
="http://jb51.net" Then
ValidEntry = False
End if
If Left(Request.ServerVariables("HTTP_REFERER"), 21)
="https://www.jb51.net" Then
ValidEntry = False
End If

' Now if ValidEntry is True then enter to log file
If ValidEntry Then
Const ForAppending = 8
Const Create = true
Dim FSO
DIM TS
DIM MyFileName
Dim strLog

MyFileName = Server.MapPath("MyLogFile.txt")
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TS = FSO.OpenTextFile(MyFileName, ForAppending, Create)

' Store all required values in strLog
strLog = "br>P>B>" now "/B> "
strLog = strLog Request.ServerVariables("REMOTE_ADDR") " "
strLog = strLog Request.ServerVariables("HTTP_REFERER") " "
strLog = strLog Request.ServerVariables("HTTP_USER_AGENT") "BR>"
' Write current information to Log Text File.
TS.write strLog
TS.Writeline ""
' Create a session varialbe to check next time for ValidEntry
Session("LogIn") = "yes"
Set TS = Nothing
Set FSO = Nothing
End If
%>

標簽:揭陽 唐山 淮北 滁州 南寧 甘南 迪慶 來賓

巨人網絡通訊聲明:本文標題《用ASP創建日志文件(附源程序)》,本文關鍵詞  用,ASP,創建,日志,文件,附,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《用ASP創建日志文件(附源程序)》相關的同類信息!
  • 本頁收集關于用ASP創建日志文件(附源程序)的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 林西县| 南通市| 温泉县| 泰州市| 肇源县| 大足县| 浦县| 宝应县| 宣武区| 泸溪县| 广宁县| 宜宾市| 黄大仙区| 莲花县| 东台市| 勃利县| 陵川县| 廉江市| 永吉县| 宁武县| 永仁县| 崇义县| 陆良县| 青海省| 卢氏县| 会昌县| 叙永县| 西丰县| 乌鲁木齐县| 手机| 万年县| 南郑县| 封丘县| 和田市| 南安市| 乃东县| 潍坊市| 扎兰屯市| 诸城市| 怀柔区| 临朐县|