We know that request.servervariables ("http_referer") can get the address of the source website, so we can use this data to make a small source access statistics to create a new database SYS_REFERER:
If EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [sys_referer]') And ObjectProperty (ID, n'uSERTABLE ') = 1) DROP TABLE [DBO]. [sys_referer] Go Create Table [dbo]. [sys_referer] ([fsitename] [varcha] (64) collate chinese_prc_ci_as not null, [fstr] [varcha] (64) collate chinese_prc_ci_as not null, [fcounts] [int] not null, [VisitTime] [DateTime ] NOT NULL) ON [PRIMARY] GOFSITENAME: VARCHAR, 64, NOT NULL, Source Site Name (User Custom)
FSTR: VARCHAR, 64, NOT NULL, keywords in the URL (such as Google Take Google.com)
Fcounts: int, not null, statistical visits
Visittime: datetime, not null, visit time
Key code:
Referr = cstr (Request.ServerVariables) IF (Referer = ") ThenReferer =" Direct Access "end if'Response.write referer'Response.write"
"SET RS = conn.execute (" SELECT FSITENAME, FSTR, FCOUNTS from Sys_referer Order by Fcounts Desc ") fsites = rs.getRows () for i = 0 to Ubound (fsites, 2) IF (Instr (Referer, Fsites (1, i))) thenconn.execute ( "Update sys_referer set fcounts = fcounts 1, Visittime = getdate () where fstr = '") Endness (1, i) & "'") end'Response.write fsites (0, i) & "[" & fsites (2 , i) & "]
" Next fsites = nullrs.closset = Nothing
Description: Here I only do the statistics of identifiable sites, and unrecognizable sites have not been counted. If you please do it yourself, I am too lazy to write.
The effect is as shown:
Transfer from:
http://goaler.xicp.net/showlog.asp?id=507