<% const dbpath="d:\www\Sfb410\wwwroot\photo\admin\data\photo.mdb" '数据库物理地址 dim conn,connstr set conn=server.createobject("adodb.connection") connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath 'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & dbPath '老驱动 conn.Open connstr sub closeconn() conn.close set conn=nothing end sub %> <% Function findname(filepath) for i=1 to len(filepath) if left(right(filepath,i),1)="/" then '查找"/,取得字符数" k=i exit for end if next if k<>1 then findname=right(filepath,k-1) end if findname=left(findname,14) '//取得前14个字符,即图片集的文件名 end Function myname=Request.ServerVariables("SCRIPT_NAME") current_url="http://"& Request.ServerVariables("SERVER_NAME") &"/" '获取当前域名,构造URL private sub transferurl() %> document.write("") document.write(""); <% end sub sub updatedb() filename=findname(Request.QueryString("comeurl"))'//获取文件名 conn.execute("update gallery set gallery_hits=gallery_hits+1 where gallery_filename='"&filename&"'") end sub if Request.QueryString("act")="save" then call updatedb() else call transferurl() end if call closeconn() %>