惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

博客园 - Ja

[转]Moving Your Access 2002 Database to SQL Server 新浪Blog支持手机Wap浏览了 示例3:论坛主题搜索 AJAX是什么? [歌词]世界末日 无题 [HTML]标签的StyleSheet [ASP]Server.Execute 我的毕业设计(一)模型调度 在C++ Builder中调用FORTRAN生成的DLL 怎么取得DLL文件中的函数名列表? 解决Navihelper.dll(女生宿舍)病毒的方法一则 过去的2004 Gmail invitations 硕泰克SL-67fv1支持PIII800EB吗? 再来一个Email Logo 我的Gmail邮箱 Who can invite me to Wallop?Thanks! 被SQL Server 2005郁闷了
[JavaScript]给自己的网站添加简单文本日志
Ja · 2005-05-18 · via 博客园 - Ja

1.用于记录日志的文件 log.asp,另外需要建立一个用于保存日志文件的文件夹logs。
log.asp文件的代码如下:

<script language="javascript" runat="server">
var fso = new ActiveXObject("Scripting.FileSystemObject");
var dt=new Date();
strDate
=String(dt.getMonth())+String(dt.getDate());
var strFileName="logs\\log"+strDate+".htm";
var filename = Server.MapPath(strFileName);
var logFile;
if(fso.FileExists(filename))
    {
        logFile 
= fso.OpenTextFile(filename,8);
    }
else
    {
        logFile 
= fso.CreateTextFile(filename,true);
    }
var str="<br>"+String(dt.getYear())+""
    
+String(dt.getMonth())+""
    
+String(dt.getDate())+""
    
+String(dt.getHours())+":"
    
+String(dt.getMinutes())+":"
    
+String(dt.getSeconds())
    
+" "+Request.ServerVariables("REMOTE_ADDR")
    
+" "+Request.ServerVariables("URL")
    
+" "+Request.ServerVariables("HTTP_USER_AGENT");
logFile.WriteLine(str);
logFile.Close();
delete logFile;
delete fso;
</script>


2.在需要记录访问的页面上,添加如下代码:

<!--#include file="log.asp"//-->

3.这样,就可以将访问者的访问时间、访问的页面以及访问者使用的浏览器和操作系统记录下来,方便网站管理者了解访问者的基本情况。

4.用于浏览日志的网页viewlog.asp代码如下:

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>日志</title>
</head>
<body>
<div>
<font size="2">
<%
    p
=Request.QueryString("p");
    tp
="log"+p+".htm";
    Server.
Execute(tp);
%>
</font>
</div>
</body>
</html>