<% LinkID = ReqTxt(Trim(Request("l"))) If Left(LinkID,2) = "JS" then CounterID = ReqTxt(Trim(Request("c"))) SourceID = ReqTxt(Trim(Request("s"))) Set RsTemp = Server.CreateObject("ADODB.Recordset") SQLStr = "SELECT LinkStr FROM TOP_WebCounter2 WHERE CounterID = '" & CounterID & "' And SourceID = '" & LinkID & "'" RsTemp.Open SQLStr, conn, 1, 1 GoToUrl = "" If RsTemp.EOF Then Response.Write("" & Chr(10)) Response.End Else GoToUrl = RsTemp("LinkStr") End If Set RsTemp = Nothing If GoToUrl <> "" Then 'If SourceID = "" Then SourceID = LinkID If SourceID = "" Then SourceID = "Main" SQLStr = "SELECT * FROM Top_WebCounter3 WHERE CounterID = '" & CounterID & "' AND SourceID = '" & SourceID & "' AND Location = '" & GoToUrl & "'" Set RsT = conn.Execute(SQLStr) If RsT.EOF Then Set cmdB = Server.CreateObject("ADODB.Command") cmdB.CommandType = 1 cmdB.ActiveConnection = Conn SQLStr = "INSERT INTO TOP_WebCounter3 (CounterID, SourceID, Location, Counter) VALUES (?,?,?,1)" With cmdB .Parameters.Append .CreateParameter("CounterID",200,1,10,CounterID) .Parameters.Append .CreateParameter("SourceID",200,1,10,SourceID) .Parameters.Append .CreateParameter("Location",200,1,200,GoToUrl) .Prepared = True .CommandText = SQLStr If .State <> 4 Then .Execute End If End With Else Set cmdB = Server.CreateObject("ADODB.Command") cmdB.CommandType = 1 cmdB.ActiveConnection = Conn SQLStr = "UPDATE TOP_WebCounter3 SET Counter = Counter + 1 WHERE CounterID = ? AND SourceID = ? AND Location = ?" With cmdB .Parameters.Append .CreateParameter("CounterID",200,1,10,CounterID) .Parameters.Append .CreateParameter("SourceID",200,1,10,SourceID) .Parameters.Append .CreateParameter("Location",200,1,200,GoToUrl) .Prepared = True .CommandText = SQLStr If .State <> 4 Then .Execute End If End With End If If Left(GoToUrl,1) = "/" Then GoToUrl = GoToUrl & "?c=" & CounterID & "&s=" & SourceID Response.Redirect(GoToUrl) Else Response.Write("" & Chr(10)) Response.End End If End If %>