View Full Version : Users - user count - know who


08-15-2008, 10:09 AM
This is probably the wrong place to put this, but.....

I did not do this yet and really don't have that much use for it, but there have been numerous questions on how to know when someone has the database open. I for one am remiss in not thinking of this before. If it is something others can use, I will get it in motion so others may see how and most of the forum can do it on their own anyhow.

Why not make your own table, called, say "cusers". Include it in the database with these fields.

nowdate d
nowtime t
nowuser c 50
nowcomp c 50
nowdone L

when a runtime (or other) opens the app, the autoexec gets the username and computer name and puts it in the cusers.dbf. Ondatabase close, it takes that record out by marking the nowdone a .f. and deleteing all that are marked as such. Others here may have even better ideas on how to use this/

This seems real simple to me and the developer or maintenance program can check for logged in users as needed.


Tom Henkel
08-15-2008, 12:50 PM
We have our own security instead of Alpha's built in security, and as such, we have a table of users with passwords, access levels, etc. One field in this record is "active". When the user signs into the system we set this flag to an "X", and also set an active_time field to the time they loged in. When they exit the app, we update the record and remove the flag and time.


Tony Rutherford
08-15-2008, 02:37 PM

If you only need to know the number of users who are logged in, but aren't interested in the user names, you can use A5_REGISTRATION_LICENSE_INUSE().


08-15-2008, 02:49 PM
Tom, Tony,

I already have my own security system and user table like Tom does and I always know how many users are in there at anytime. Who is not that important, but could be to others.

Tom has a great idea with the extra field for those who have their own security. Thanks Tom! I may add that in.

My table looks like this one below:

08-17-2008, 09:04 PM
Hello Tom,
Could you elaborate somewhat on what you did?

This below is provided by the Alpha help.
dim nSessions as N
nSessions = a5_count_websessions()
? nSessions
= 15

I modified it a little and have this in my page footer.

dim nSessions as N
nSessions = a5_count_websessions()
if a5_count_websessions()<2
? "There is " + nSessions + " user online"+"<BR>"
if eval_valid("session.__protected__userid")
? session.__protected__userid
end if
end if

if a5_count_websessions()>1
? "There are " + nSessions + " users online"+"<BR>"
if eval_valid("session.__protected__userid")
? session.__protected__userid+", "
end if
end if

This gives the count and the userid(s) of who are online. But I would like to provide a link on this userid allowing people to click it and view the user's details. I think you are on the track I'm looking for.

How do you know when they exit the app?
How does the "flag" go away if the user does not log out but the session times out?

08-19-2008, 09:32 PM
If you only need to know the number of users who are logged in, but aren't interested in the user names, you can use A5_REGISTRATION_LICENSE_INUSE().


I don't think that function was around when I first got the uswer count. I check both muff files for the count and add them together into a variable. This gives me runtime and any other users.

It seems it would be useful to know WHO in a very large lan. If I had 100 users on at any given tim. How do you check them all at one time?