
<%
Dim Connsy

On Error Resume Next

	
	set Connsy=Server.CreateObject ("Adodb.Connection")
	Connsy.Open "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath(""&db&"")


		dim rs_1,sql_1,addsss,tjid

		Set Rs_1 = Server.CreateObject("Adodb.Recordset")

		Sql_1 = "select [id],[time] from qtwap_tj where DATEDIFF('d', time, now())=0 "
		Rs_1.Open Sql_1,connsy,1,3
		if not (rs_1.bof and rs_1.eof)  then
			tjid=rs_1("id")
		else
			rs_1.addnew
			rs_1("time")=now()
			rs_1.update
			tjid=rs_1("id")
		end if
		Rs_1.close


		Sql_1 = "select [ip],[count],[tjid],[time] from qtwap_tj_list where DATEDIFF('d', time, now())=0 and ip='"&Request.ServerVariables("REMOTE_ADDR")&"'"
		Rs_1.Open Sql_1,connsy,1,3
		if not (rs_1.bof and rs_1.eof)  then
			rs_1("tjid")=tjid
			rs_1("count")=rs_1("count")+1
			rs_1("time")=now()
			rs_1("ip")=Request.ServerVariables("REMOTE_ADDR")
			rs_1.update
			addsss=false
		else
			rs_1.addnew
			rs_1("tjid")=tjid
			rs_1("count")=1
			rs_1("time")=now()
			rs_1("ip")=Request.ServerVariables("REMOTE_ADDR")
			rs_1.update
			addsss=true
		end if
		Rs_1.close

		if addsss=true then
			connsy.execute("update qtwap_tj set [Count]=[Count]+1,ipCount=ipCount+1 where id="&tjid&"")
		else
			connsy.execute("update qtwap_tj set [Count]=[Count]+1 where id="&tjid&"")
		end if

		set rs_1=nothing
%>