<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/chkinput.asp"-->
<%
If Not IsObject(Conn) Then ConnectionDatabase
Dim SQL,TempNum
Dim strReturnURL,MyUserID,Asked_Cookies
strReturnURL = Trim(Request("ReturnURL"))
If CheckeIsURL(strReturnURL) Then
	strReturnURL = Server.HTMLEncode(strReturnURL)
	If LCase(Mid(strReturnURL,8,Len(Request.ServerVariables("SERVER_NAME"))))=LCase(Request.ServerVariables("SERVER_NAME")) Then
		strReturnURL = Server.HTMLEncode(strReturnURL)
	Else
		strReturnURL = NewAsp.InstallDir
	End If
Else
	strReturnURL = NewAsp.InstallDir
End If
MyUserID = NewAsp.UserID
Asked_Cookies = NewAsp.Asked_sn
If Len(strReturnURL) > 8 Then
	If InStr(LCase(Left(strReturnURL,10)),"user") = 0 And InStr(LCase(Left(strReturnURL,10)),"post") = 0 And InStr(LCase(Left(strReturnURL,10)),"save") = 0 Then
		strReturnURL = strReturnURL
	Else
		strReturnURL = NewAsp.InstallDir
	End If
Else
	strReturnURL = NewAsp.InstallDir
End If

If NewAsp.UserID>0 Then
	SQL="DELETE FROM NC_Ask_Online WHERE userid="& CLng(NewAsp.UserSession.documentElement.selectSingleNode("userinfo/@userid").text)
	Conn.Execute SQL,TempNum
	If TempNum>0 Then
		NewAsp.ReloadSetupCache NewAsp.AskedOnline-TempNum,12
	End If
Else
	If IsNumeric(NewAsp.UserSession.documentElement.selectSingleNode("userinfo/@statuserid").text) Then 
		SQL="DELETE FROM NC_Ask_Online WHERE id="& CCur(NewAsp.UserSession.documentElement.selectSingleNode("userinfo/@statuserid").text)
		Conn.Execute SQL,TempNum
		If TempNum>0 Then
			NewAsp.ReloadSetupCache NewAsp.AskedOnline-TempNum,12
		End If
	End If
End If
If EnabledSession Then	
	Session(NewAsp.CacheName & "UserID")=Empty
End If

NewAsp.CloseConn()
If MyUserID > 0 Then
	Response.Cookies(Asked_Cookies) = Empty
	Session.Abandon
	Response.Redirect (strReturnURL)
Else
	Response.Redirect (strReturnURL)
End If
%>