Howzit!!

I am maintaining a Web page where the User needs to be logged in I then lock that user account so that only one account can be used at a time, Now if the User forgets to logg out or leaves the system un attented for a set amount of time I would like to Logg him out automatically and redirect the user to a page, I had a go at it and here's my code, could you please help me out??

********************
<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo"></OBJECT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
If isEmpty(Application("counter")) Then
Application("counter") = 0
Application("count") = 0
else
Application("counter") = Application("counter") + 1
Application("count") = Application("count") + 1
end If

Session.TimeOut=5

End Sub

Sub Session_onEnd

Application("count") = Application("count") - 1

dim cnMain
dim lcDate
dim lcTime
dim sSQL

lcdate = FormatDateTime(Now(),vbShortDate)
sday = mid(lcdate,instr(lcdate,"/")+1,instr(mid(lcdate,instr(lcdate,"/")+1),"/")-1)
if len(sday) < 2 then
sday = "0" & sday
end if
smonth = mid(lcdate,1,instr(lcdate,"/")-1)
if len(smonth) < 2 then
smonth = "0" & smonth
end if
syear = "20" & right(lcdate,2)
lcdate = sday & "/" & smonth & "/" & syear

lcTime = FormatDateTime(Now, vbLongTime)

sSQL = "Provider=SQLOLEDB.1;Persist Security Info=False;Data Source=MyServer;Initial Catalog=MyCat;User ID=Guest;Password=;ConnectionTimeout=10;"

Set cnMain = Server.CreateObject("ADODB.Connection")
cnMain.Mode = abModeReadWrite
cnMain.ConnectionString = sSQL
cnMain.open

sTime = FormatDateTime(time,vbShortTime)
conn.Execute("INSERT INTO AuditTrail (Audit_UID, Audit_Date, Audit_Time, Audit_Flag, Audit_InOut, Audit_Reason) Values ('" & Session("sUID") & "','" & lcdate & "','" & lctime & "','0','In','Session Time Out')")

conn.Execute("Update Users Set User_Locked = 0 WHERE User_UID = '" & Session("sUID") & "' AND User_Comp_UID = '" & Session("sCID") & "'")


cnMain.Close

Response.Redirect "http://www.newsclip.co.za/asp/session.asp"

End Sub
</Script>

********************

Thanks in Advance!