If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Global.log recording files - user on line

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-13-03, 09:09
ejoyce ejoyce is offline
Registered User
 
Join Date: May 2003
Posts: 2
Talking Global.log recording files - user on line

Hi

Making a visitors online (counter only) is relatively easy by manipulaing the global.asa file. But how would one go about creating a counter that allows you to also see the actual "UserNames" of the visitors online

Any assistance would be much appreciated


I have the four following files listed below...
However I cant see where is the problem...
I ve put all(files) in this path...
I bring the site (https://pgex.ipt.br/tj), then I log in and after that I add to it https://pgex.ipt.br/tj/session.asp as showed and as result when I click over session.log it comes in blank to me, instead of to bring the data that come from this line objFile.WriteLine "Session: " & Session.SessionID & " started at " & Now () - in global.asa and so on


Note: I´ve created i blank a file called session.log : | ? ! ?

Thanks a lot

Joyce : )


---------------abandon.asp------------------
<%@ Language="VBScript" %>
<%
Session.Abandon
Response.Write("<html><head></head>")
Response.Write("<body onLoad=""self.close();""></body>")
Response.Write("</html>")
%>
---------------global.asa------------------
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

' I do this because you can't use Server.MapPath
' in Session_OnEnd... you'll have to modify this
' to reflect the appropriate path on your server.
Const strLogFilePath = "\\pgex\C\Inetpub\wwwroot\tj\session.log"

Sub Application_OnStart
Application("Start") = Now()
End Sub

Sub Session_OnStart
Session.Timeout = 5
Session("Start") = Now()

Dim objFSO, objFile
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strLogFilePath, 8, True)
Set objFSO = Nothing
objFile.WriteLine "Session: " & Session.SessionID & " started at " & Now ()
objFile.Close
Set objFile = Nothing
End Sub

Sub Session_OnEnd
Dim objFSO, objFile
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strLogFilePath, 8, True)
Set objFSO = Nothing
objFile.WriteLine "Session: " & Session.SessionID & " ended at " & Now ()
objFile.Close
Set objFile = Nothing
End Sub

Sub Application_OnEnd
End Sub

</SCRIPT>
---------------session.asp------------------
<%@ Language="VBScript" EnableSessionState="True" %>
<html>
<head>
<title>Session Timeout Test</title>
</head>
<body onUnLoad="this.open('abandon.asp', 'CtrlWindow', 'toolbar=no,menubar=no,location=no,scrollbars=no,r esizable=no,width=150,height=150');">

<p>
<strong>Current SessionId: <%= Session.SessionID %></strong>
</p>
<p>
This page just outputs your current session id for
reference. Check the <a href="session.log">session.log</a>
file for session OnStart and OnEnd timestamps.
</p>
<p>
I've set the Session.Timeout to 5 minutes so take note
of your session id and close your browser. Then check
the log file within the next couple minutes. You'll
see no session ended log entry. Wait for the 5 minutes
to pass and check again and it should be there.
</p>

</body>
</html>
---------------session.log------------------

--------------------------------------------------
Reply With Quote
  #2 (permalink)  
Old 05-16-03, 04:38
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 441
Re: Global.log recording files - user on line

erm,

I don't know if it is the correct way of doing it, but when the user logs in to my site, instead of doing;
Code:
select count(*) from users where name=X and pass=Y
i do
Code:
update users set loggedin=true where name=X and pass=Y


then session("username") is set to the name, if it returns greater than 0 rows modified. The user is then logged in.

When the user either logs out, or his/her session expires, the revese of that query is done (setting the user to loggedin = false).

Thus i can list the currently logged in users with a simple query.
Reply With Quote
  #3 (permalink)  
Old 05-16-03, 07:06
ejoyce ejoyce is offline
Registered User
 
Join Date: May 2003
Posts: 2
Smile hi

thanks a lot
Reply With Quote
  #4 (permalink)  
Old 05-16-03, 09:20
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 441
I hope it's useful!

let me know how you get/got on
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On