<%@ Language=VBScript %> <% '********************************************************************************* '********************************************************************************* '** '** Ad Banner Redirect '** By : Andrew Putnam '** Created : Feb 22, 2002 '** '** Usage : '** Gets the bannerID from the image link. Updates refer count and '** Redirects to the site if a valid bannerID is passed. '** '** NOTES : If an invalid bannerID is passed, www.ocmodshop.com is loaded '** instead. '** '********************************************************************************* '********************************************************************************* Dim bConn, bCmd, bRs, bSQL, redirURL, bannerID bannerID = Request.QueryString("bid") bannerID = Trim(bannerID) '** clean off crap.... bannerID = Replace(bannerID, "%", "") bannerID = Replace(bannerID, "'", "") bannerID = Replace(bannerID, ",", "") bannerID = Replace(bannerID, "*", "") bannerID = Replace(bannerID, "[", "") bannerID = Replace(bannerID, "]", "") bannerID = Replace(bannerID, "-", "") bannerID = Replace(bannerID, "#", "") If IsNumeric(bannerID) AND Len(bannerID) <= 10 And bannerID <> "" Then '** check numeric and length bSQL = "SELECT linkURL FROM AdBanners WHERE bannerID = " & bannerID Set bConn = Server.CreateObject("ADODB.Connection") bStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("/counter/adbanner.mdb") With bConn .ConnectionString = bStr .Mode = adModeShareDenyNone .Open End With Set bCmd = Server.CreateObject("ADODB.Command") With bCmd .ActiveConnection = bConn .CommandType = 1 .CommandText = bSQL End With Set bRs = Server.CreateObject("ADODB.Recordset") Set bRs = bCmd.Execute If Not bRs.BOF Then linkURL = bRs.Fields(0).Value Else '** no match, load homepage linkURL = "http://www.ocmodshop.com" End If bRs.Close '** if was a good bannerID, then update referCount If linkURL <> "http://www.ocmodshop.com" Then bSQL = "UPDATE AdBanners SET referCount = referCount + 1 WHERE bannerID = " & bannerID bCmd.CommandText = bSQL bCmd.Execute End If bConn.Close Set bRs = Nothing Set bCmd = Nothing Set bConn = Nothing Else '** no match, load homepage linkURL = "http://www.ocmodshop.com" End If Response.Redirect(linkURL) %>