{"id":779,"date":"2011-11-18T00:19:56","date_gmt":"2011-11-17T16:19:56","guid":{"rendered":""},"modified":"2014-03-11T22:40:45","modified_gmt":"2014-03-11T14:40:45","slug":"%e7%94%a8asp%e5%88%9b%e5%bb%ba%e6%97%a5%e5%bf%97%e6%96%87%e4%bb%b6%e7%9a%84%e5%ae%9e%e4%be%8b%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2011\/11\/18\/779.htm","title":{"rendered":"\u7528ASP\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u7684\u5b9e\u4f8b\u4ee3\u7801"},"content":{"rendered":"<p>\u7528Asp\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u8fd9\u4e2a\u4f8b\u5b50\u4f7f\u7528\u6587\u672c\u6587\u4ef6\u6765\u5199\u5165\u7528\u6237\u7684\u4fe1\u606f\u521b\u5efa\u4e00\u4e2alogfile.asp\u653e\u5728\u6bcf\u4e00\u4e2aasp\u7684\u9875\u9762\u7684\u9876\u7aef&lt;!&#8211;#Include File=&quot;LogFile.asp&quot;&#8211;&gt;\u5f53\u6709\u4eba\u6765\u8bbf\u95ee\u4f60\u7684\u7ad9\u70b9logfile.asp\u81ea\u52a8\u628a\u4ed6\u7684\u4fe1\u606f\u5199\u5165LogFile.txt,\u5982\u679c\u76f8\u5173\u7684URl\u4e00\u6837\u7684\u8bdd\u5219\u4e0d\u5199\u5165\u6587\u4ef6 <br \/>\nFile: LogFile.asp <br \/>\n\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p>&lt;% <br \/>\nDim ValidEntry &#8216; Log variable <br \/>\n&#8216; First set that this log is valid <br \/>\nValidEntry = True<\/p>\n<p>&#8216; If Session Variable &quot;LogIn&quot; is not empty <br \/>\n&#8216; that mean this person has already been logged <br \/>\n&#8216; then set ValidLog to False <br \/>\nIf not IsEmpty(Session(&quot;LogIn&quot;)) then ValidEntry = False<\/p>\n<p>&#8216; Here you can add different restriction <br \/>\n&#8216; If the refering url is from same site <br \/>\n&#8216; don&#8217;t write to log file <br \/>\nIf Left(Request.ServerVariables(&quot;HTTP_REFERER&quot;), 17) <br \/>\n=http:\/\/jzxue.com Then <br \/>\nValidEntry = False <br \/>\nEnd if <br \/>\nIf Left(Request.ServerVariables(&quot;HTTP_REFERER&quot;), 21) <br \/>\n=http:\/\/www.jzxue.com Then <br \/>\nValidEntry = False <br \/>\nEnd If<\/p>\n<p>&#8216; Now if ValidEntry is True then enter to log file <br \/>\nIf ValidEntry Then <br \/>\nConst ForAppending = 8 <br \/>\nConst Create = true <br \/>\nDim FSO <br \/>\nDIM TS <br \/>\nDIM MyFileName <br \/>\nDim strLog<\/p>\n<p>MyFileName = Server.MapPath(&quot;MyLogFile.txt&quot;) <br \/>\nSet FSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;) <br \/>\nSet TS = FSO.OpenTextFile(MyFileName, ForAppending, Create)<\/p>\n<p>&#8216; Store all required values in strLog <br \/>\nstrLog = &quot;&lt;br&gt;&lt;P&gt;&lt;B&gt;&quot; &amp; now &amp; &quot;&lt;\/B&gt; &quot; <br \/>\nstrLog = strLog &amp; Request.ServerVariables(&quot;REMOTE_ADDR&quot;) &amp; &quot; &quot; <br \/>\nstrLog = strLog &amp; Request.ServerVariables(&quot;HTTP_REFERER&quot;) &amp; &quot; &quot; <br \/>\nstrLog = strLog &amp; Request.ServerVariables(&quot;HTTP_USER_AGENT&quot;) &amp; &quot;&lt;BR&gt;&quot; <br \/>\n&#8216; Write current information to Log Text File. <br \/>\nTS.write strLog <br \/>\nTS.Writeline &quot;&quot; <br \/>\n&#8216; Create a session varialbe to check next time for ValidEntry <br \/>\nSession(&quot;LogIn&quot;) = &quot;yes&quot; <br \/>\nSet TS = Nothing <br \/>\nSet FSO = Nothing <br \/>\nEnd If <br \/>\n%&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528Asp\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u8fd9\u4e2a\u4f8b\u5b50\u4f7f\u7528\u6587\u672c\u6587\u4ef6\u6765\u5199\u5165\u7528\u6237\u7684\u4fe1\u606f\u521b\u5efa\u4e00\u4e2alogfile.asp\u653e\u5728\u6bcf\u4e00\u4e2aasp\u7684\u9875\u9762\u7684\u9876\u7aef&lt;!&#8211;#Include File=&quot;LogFile.asp&quot;&#8211;&gt;\u5f53\u6709\u4eba&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-779","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=779"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/779\/revisions"}],"predecessor-version":[{"id":66622,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/779\/revisions\/66622"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=779"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=779"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}