Counter | design | graphic | Here's a nice graphics counter designed without CGI.
Here is divided into three parts: 1, the establishment of graphics files.
2, establish the database.
3, write the code.
1, create graphics files.
First, use the graph software to make 10 graphs to display the count
10 digits of the device: 1,2,3,4,5,6,7,8,9,0. If
You have the art talent and you can make better graphics.
2, establish the database.
Use to create a database with the name. The database contains a table,
The first name is, the structure is: integer, there is a record, the initial value is 0.
Used to store the number of times the page was last accessed.
3, write the code.
—————— number.asp ————————————
<%@ language= "VBScript"%>
<!--#include file= "Adovbs.inc"-->
<%
Set Objconn=server.createobject ("Adodb.connection")
Objconn.attributes=adxactcommitretaining
Dbpath=server.mappath ("Num.mdb")
objConn.Open "Driver={microsoft Access Driver (*.mdb)};d bq=" & DBPath
Note: Establish a connection to the database.
sqlquery= "SELECT * from NUMT"
Set Rsrecordset=server.createobject ("Adodb.recordset")
Rsrecordset.open sqlquery,objconn,adopenkeyset,adlockoptimistic
Note: Open the database.
Application.Lock
Application ("NMB") =rsrecordset ("number")
Application.UnLock
Note: Assigns the last access count to the Application object
Application.Lock
Application ("NMB") =application ("NMB") +1
Application.UnLock
Rsrecordset ("number") =rsrecordset ("number") +1
Rsrecordset.update
Rsrecordset.close
Objconn.close
Set rsrecordset=nothing
Set objconn=nothing
Remarks: Closes the database, releasing the object
Dim nmb1
Dim str ()
Nmb1=application ("NMB")
ReDim Str (NMB1)
For I=1 to Len (NMB1)
STR (i) =mid (nmb1,i,1)
Note: Get the corresponding graphics file for each number
Select Case STR (i)
Case "0"
imgf= "0.gif"
Case "1"
imgf= "1.gif"
Case "2"
imgf= "2.gif"
Case "3"
imgf= "3.gif"
Case "4"
imgf= "4.gif"
Case "5"
imgf= "5.gif"
Case "6"
imgf= "6.gif"
Case "7"
imgf= "7.gif"
Case "8"
imgf= "8.gif"
Case "9"
imgf= "9.gif"
End Select
Note: Output graphics
Response.Write "Next
%>