need help

S

Savas Ates

i have a website... when a user sign up my site

sql="UPDATE users set status=1 WHERE userid = '&username&';"

but when a user leave my site i want to adjust status as =0 in my database
and when user click another user he must see his status


to make this onsession end and on application .end i used codes below.. but
it doesnt workk. what is the problem. i look at aspfaq.com but i didnt find
any solution... how can i solve this problem.. with any different idea??
help me please..



Sub Application_OnEnd
set sodb = Server.CreateObject("ADODB.Connection")
sodb.Open "PROVIDER=SQLOLEDB;Initial Catalog=friends;User Id=sa
;password=;Data Source=localhost"
Set cmdTemp = Server.CreateObject("ADODB.Command")
cmdTemp.CommandType = adCmdText
Set cmdTemp.ActiveConnection = sodb
cmdtemp.CommandText = "UPDATE users set status=0 WHERE userid = 'savas';"
set setUserOffline = Server.CreateObject("ADODB.Recordset")
setUserOffline.Open cmdTemp, , adOpenStatic, adLockOptimistic
sedb.close
set sodb = nothing
End Sub


Sub Session_OnEnd 'Runs when a user's session times out or quits
your application
set sodb = Server.CreateObject("ADODB.Connection")
sodb.Open "PROVIDER=SQLOLEDB;Initial Catalog=friends;User Id=sa
;password=;Data Source=localhost"
Set cmdTemp = Server.CreateObject("ADODB.Command")
cmdTemp.CommandType = adCmdText
Set cmdTemp.ActiveConnection = sodb
cmdtemp.CommandText = "UPDATE users set status=0 WHERE userid = 'savas';"
set setUserOffline = Server.CreateObject("ADODB.Recordset")
setUserOffline.Open cmdTemp, , adOpenStatic, adLockOptimistic
sedb.close
set sodb = nothing
End Sub
 
D

dlbjr

<SCRIPT language="vbscript" runat="server">
Sub Application_OnStart()
Application("CONN_STRING") = "PROVIDER=SQLOLEDB;Initial Catalog=friends;"&_
"User Id=sa;password=;Data Source=localhost"
Sub Application_OnEnd()
EndStatus "savas"
End Sub

Sub Session_OnStart()
EndStatus "savas"
End Sub

Sub Session_OnEnd()
EndStatus "savas"
End Sub

Sub EndStatus(strUserID)
strSQL = "UPDATE users set status=0 WHERE userid='" & strUserID & "';"
Set cmd = CreateObject("ADODB.Command")
cmd.CommandType = adCmdText
cmd.CommandText = strSQL
Set Conn = CreateObject("ADODB.Connection")
Conn.Open Application("CONN_STRING")
cmd.ActiveConnection = Conn
cmd.Execute
Set cmd = nothing
Set Conn = nothing
End Sub
</SCRIPT>

dlbjr
Pleading sagacious indoctrination!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top