web tools rank checker

domain .cn
.net .cn .com.cn
你正在阅览 :: 简体中文:: 学习 ASP SQL VB HTML code

学习 .ASP SQL HTML XML CSS JAVA Perl code study
English Chinese_Traditional Chinese_Simplified

你正在阅览 :: 简体中文 Chinese_Simplified

学习.主题:
首页
ASP
. Active-Server-Flash
. Array
. Connection
. Count
. Counter
»counter_script
. Distinct
. Email
. File
. Folder
. Function
. GetSQLserver
. Header
. mySQL
. Record
. Recordset
. Request
. Response
. Server
. Server-CreateObject
. ServerVariables
. Session
. Special-Symbols
. String
. Sub
. Time
CSS
Ecommerce
HTML
InternetProtocol
JAVA
Microsoft
Robots
SearchEngine
SQL
SQLserver
VBscript
XML

SiteMap

3w....学习.教学 > ASP > counter » counter_script

3w learning

counter >
counter_script

Title:

counter_script


Description:

base on IP, no duplicate IP each day counter Table1 id IP date (time) visitors hits 1 *.*.*.77 11/9/2007 1 2 2 *.*.*.99 11/9/2007 1 3


Example Code:

<% '--------------the script created by ezer.com --------- IP=request.servervariables("remote_addr") Today=date oneVisitor=1 oneHit=1 '---------- no duplicate IP each day --------------- Set rs1 = GetSQLserverRecordset (conn, "select * from TB1 where IP='"&IP&"' and date='"&Today&"' ") if rs1.eof then ' can not find one rs1.AddNew rs1("IP")=IP rs1("date")=Today rs1("visitors")=oneVisitor rs1("hits")=oneHit rs1.Update else rs1("hits")=rs1("hits")+1 rs1.Update end if '-------- Sum Total of a field ---------------------- SQL2="SELECT SUM(visitors) AS sumVisitors from TB1 where date='"&Today&"' " Set RS2 = Server.CreateObject("ADODB.Recordset") RS2.Open SQL2,conn sumVisitors=rs2("sumVisitors") SQL3="SELECT SUM(hits) AS sumHits from TB1 where date='"&Today&"' " Set RS3 = Server.CreateObject("ADODB.Recordset") RS3.Open SQL3,conn sumHits=rs3("sumHits") rs1.close rs2.close rs3.close %> Today is : <%=date%><br> Today Total visitors: <%=sumVisitors%> <br> Today Total hits : <%=sumHits%>


Example Result:

Set Rs = Server.CreateObject("ADODB.Recordset") Rs.Open Source, ActiveConnection, CursorType, LockType, Options


Today is : 11/9/2007 Today Total visitors: 2 Today Total hits : 5 ---------- tips memo ---------- if you get this: "Microsoft VBScript runtime error '800a000d' Type mismatch: 'GetSQLserverRecordset' " this means: you forget to setup the function for 'GetSQLserverRecordset' that is why [ mismatch ] you need add a function for this and you may name it whatever name you want Function GetSQLServerRecordset( conn, source ) Dim rs Set rs = Server.CreateObject("ADODB.Recordset") rs.Open source, conn, 2, 2 Set GetSQLServerRecordset = rs End Function ------------------------------- For Access : GetMDBStaticRecordset .... For Excel: GetExcelStaticRecordset For FoxPro :GetExcelStaticRecordset For Text : GetTextStaticRecordset For dBase : GetdBaseStaticRecordset For SQLserver : GetSQLserverStaticRecordset


..
...
...

[ 7/27/2008 ]

www learning school add more scripts and tips memo
You are at >>3WS.EZER.COM >> 3WS.EZER.COM/ASP/COUNTER/COUNTER_SCRIPT.ASP>>ASP
Helpful link:: SEO web tools :: Live PR | SERP checker
back to top Ezer code adding :: Questions ;email