<% Option Explicit %> <% '#################################### '## Application: Aleza Portal '## File Name: catredir.asp '## File Version: 0.56b '#################################### %> <% Response.Buffer = True %> <% 'Dimention variables Dim catRec Dim cat Dim newUrl Dim lday Dim display Dim lmonth Set catRec = Server.CreateObject("ADODB.Recordset") Set objConn = Server.CreateObject ("ADODB.Connection") cat = cint(request.querystring("cat")) objConn.Open strConnect catRec.Open "SELECT * FROM cats WHERE catid = " & cat & ";", objConn, 3, 3, 1 display = catRec("display") if instr(display, "?") then newURL = display elseif instr(display, "ID=") then Set catRec = Nothing objConn.Close Set objConn = Nothing Response.Redirect "catredir.asp?cat=" & trim(replace(display, "ID=", " ")) else newUrl = catRec("display") & "?tree=" & cat end if 'Do hits for category - First the days lday = catRec("lday") lmonth = catRec("lmonth") if lday = day(now()) then objConn.Execute "UPDATE cats SET dhits = dhits + 1 WHERE catid = " & cat else objConn.Execute "UPDATE cats SET lday = "& day(now()) &", dhits = 1 WHERE catid = " & cat end if 'Now the months if lmonth = month(now()) then objConn.Execute "UPDATE cats SET mhits = mhits + 1 WHERE catid = " & cat else objConn.Execute "UPDATE cats SET lmonth = "& month(now()) &", mhits = 1 WHERE catid = " & cat end if 'And the total hits objConn.Execute "UPDATE cats SET cats.hits = cats.hits + 1 WHERE catid = " & cat 'Clean Up objConn.Close Set objConn = Nothing Response.Redirect newUrl %>