<% '*********************************************************************** '** Copyright (C) 2001 - 2003 Max Yuan All Rights Reserved '** '** By using this program, you are agreeing to the terms of the '** GNU General Public License. '** '** This program is free software; you can redistribute it and/or '** modify it under the terms of the GNU General Public License '** as published by the Free Software Foundation; either version 2 '** of the License, or any later version. '** '** All copyright notices regarding MaxWebPortal must remain intact '** in the scripts and in the outputted HTML. '** The "powered by" text/logo with a link back to '** http://www.maxwebportal.com in the footer of the pages MUST '** remain visible when the pages are viewed on the internet or intranet. '** '** Support can be obtained from support forums at: '** http://www.maxwebportal.com '** '** Email: maxwebportal@hotmail.com '** ICQ: 148111300 '*********************************************************************** %> <% set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Open strConnString mode = Request.QueryString("mode") if mode <> "random" then linkid = Request.QueryString("id") if IsNumeric(linkid) = True then linkid = cLng(Request.QueryString("id")) else Response.write "File not Found" Response.End end if lastdate = Request.Cookies("date") lastid = Request.Cookies("linkid") if lastid <> linkid then my_Conn.Execute("UPDATE links SET Hit = HIT + 1 Where link_ID =" & linkid) Response.Cookies("linkid") = linkid Response.Cookies("linkid").Expires = dateadd("d",7,strForumTimeAdjust) end If dim rs Set rs = my_Conn.Execute("SELECT URL FROM LINKS WHERE LINK_ID = " & linkid) linkurl = RS("URL") set rs = nothing else strSQL = "SELECT top 1 LINK_ID FROM LINKS ORDER BY LINK_ID DESC" Set rsLink = my_CONN.Execute(strSQL) if not rsLink.eof then intUpperLinkID = rsLink("Link_ID") end if set rsLink = nothing Response.Write intUPperLinkID blnRandomLinkExist = false dim rsRandomLink set rsRandomLink = server.CreateObject("adodb.recordset") do While not blnRandomLinkExist Randomize intLinkID = Int((intUpperLinkID + 1) * Rnd) strRandomLinkSQL= "SELECT URL FROM LINKS WHERE LINK_ID = " & intLinkID rsRandomLink.open strRandomLinkSQL, my_Conn if rsRandomLink.eof then blnRandomLinkExist = false else blnRandomLinkExist = true linkurl = rsRandomLink("URL") end if rsRandomLink.Close loop set randomLINKRS = nothing end if my_Conn.Close set my_Conn = nothing Response.Redirect (linkurl) %>