一个软件用户的统计问题,您有高招吗?能验证一下已有的代码吗?
问题很简单,就是想知道一个(免费)软件的用户数量有多少? 前题是在线统计(不能重复统计)
设想是这样的:
1,当在线用户启动该软件时,软件就会向固定网站发送该用户的电脑特征码(如硬盘特征码);
2,网站接收到上面信息即进行统计,同样的特征码不重复统计;
请问:
实现上面第一项的设想要用什么代码(VB6)?
实现上面第二项的设想要用什么代码?(HTML)或其它?
有下面引用一组代码,偶不懂,希望有人来验证或提出更好的方案;
服务端用的ASP+ACCESS
ACCESS文件名vinet.mdb
表名vi
字段如下
id - 自动编号
ip - 文本
code - 文本
stime - 日期时间
get.asp
VBScript code
<%
option explicit
dim con
Set con = Server.CreateObject("ADODB.Connection")
con.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("vinet.mdb")
dim code
code=request.querystring("code")
code=replace(code,"'","")
code=replace(code,";","")
if len(code)=0 then response.end
dim rs
set rs=server.createobject("adodb.recordset")
rs.open " select * from vi where code='" & code & "'",con,1,3
if rs.recordcount=0 then
rs.addnew
rs("ip")=request.servervariables("remote_addr")
rs("code")=code
rs("stime")=now
rs.update
end if
rs.close
set rs=nothing
con.close
set con=nothing
%>
show.asp
VBScript code
<%
option explicit
dim con
Set con = Server.CreateObject("ADODB.Connection")
con.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("vinet.mdb")
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select * from vi order by stime desc",con,1,3
if rs.recordcount>0 then
response.write "<table border='1'>"
response.write "<tr bgcolor='lightblue'>"
response.write "<td>提交时间</td>"
response.write "<td>IP</td>"
response.write "<td>特征码</td>"
response.write "</tr>"
rs.movefirst
while not rs.eof
response.write "<tr>"
response.write "<td>" & rs("stime") & "</td>"
response.write "<td>" & rs("ip") & "</td>"
response.write "<td>" & rs("code") & "</td>"
response.write "</tr>"
rs.movenext
wend
response.write "</table>"
end if
rs.close
set rs=nothing
con.close
set con=nothing
%>
vb工程中
添加部件 microsoft internet transfer control
form1中添加inet控件名inet1
command1
代码如下
code
Option Explicit
Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Command1_Click()
Dim SN As Long
Dim str1 As String * 255
Dim str2 As String * 255
GetVolumeInformation "C:\", str1, Len(str1), SN, 0, 0, str2, Len(str2)
Inet1.OpenURL ("WEB服务器主机名/get.asp?code=" & SN)
End Sub