Click to See Complete Forum and Search --> : Session_OnEnd and 2d Array


pelegk1
04-29-2003, 09:16 AM
i want to make a 2d list that will hold the ip and time of users going in and out!
i have this code :
on GLOBAL.ASA :
Session.Timeout = 1

Sub Application_OnStart

Dim CTSessionCounter(500,1)
Application("myArr")=CTSessionCounter
Application("arrCounter")=0

End Sub

Sub Session_OnEnd
Dim tmpArr
tmpArr=Application("myArr")
for i=lbound(tmpArr) to ubound(tmpArr)
if instr(1,tmpArr(i,0),Request.ServerVariables("REMOTE_ADDR"))) then
tmpArr(i,0)=""
tmpArr(i,1)=""
Application("arrCounter")=Application("arrCounter")-1
exit for
end if
next
End Sub

and i have a page that add every 1 that enter it to my list like this :
dim tmpArr,flag
dim emptyIndex
flag=true
tmpArr=Application("myArr")

for i=lbound(tmpArr) to ubound(tmpArr)
if instr(1,tmpArr(i,0),Request.ServerVariables("REMOTE_ADDR")) then
flag=false
exit for
else
if instr(1,tmpArr(i,0),"") then
Response.Write "i : " &i
emptyIndex=i
end if
end if
next

if flag then
tmpArr(emptyIndex,0)=TRIM(Request.ServerVariables ("REMOTE_ADDR"))
tmpArr(emptyIndex+1,1)=Date()
Application("myArr")=tmpArr
Application("arrCounter")=Application("arrCounter")+1
end if
tmpArr=Application("myArr")

when i check the Application("myArr") from another page that only print's the array i get that (AFTER!!!!! session_onEnd is being DOne) there was no change done in the array!
what to do?whats tthe problem?
thnaks in advance
Peleg

pelegk1
04-30-2003, 03:11 AM
Array in vbscript is an Object! as so Session_OnEnd don't let you access and creae object, so when i try to access the array or when i try to put it in the appliaction :
application()=tmpArray(2d) it isnt working!

Peleg
in 1 week israel will be 55