473,800 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Who's signed in

Anyone know a good way to check if someone is signed in, has a session
going, etc.? I could have a signed in field that updates from 'yes' to 'no'
when they sign out, but that wouldn't work well when the session times out
or they just close the browser. Thx.
Steve.
Jul 17 '05 #1
3 1982

"szar" <no**@nowhere.n et> wrote in message
news:Di******** *******@newssvr 22.news.prodigy .com...
Anyone know a good way to check if someone is signed in, has a session
going, etc.? I could have a signed in field that updates from 'yes' to 'no' when they sign out, but that wouldn't work well when the session times out
or they just close the browser. Thx.
Steve.


BTW, I do have access to cron jobs but nothing else on the server.
Steve.
Jul 17 '05 #2
szar wrote:

"szar" <no**@nowhere.n et> wrote in message
news:Di******** *******@newssvr 22.news.prodigy .com...
Anyone know a good way to check if someone is signed in, has a session
going, etc.? I could have a signed in field that updates from 'yes' to

'no'
when they sign out, but that wouldn't work well when the session times
out or they just close the browser. Thx.
Steve.


BTW, I do have access to cron jobs but nothing else on the server.
Steve.


Hi Steve,

Two solutions,

1) using the filesystemstora ge and session.gc_prob ability
(I don't recommend this)

If you work with sessionstorage on the filesystem (session.save_h andler =
files), you could try this:
(It is a bit ugly)
When you create your session, store the name of the sessionfile (often
stored in temp-directory, check your php.ini session.save_pa th = /tmp) in
some databasetable accompanied with the username.
Check every X minutes the if the filenames stored in the database are still
in the tempdirectory.
If not delete them from your table.

To make this a little more reliable you might consider to change the value
of session.gc_prob ability to a much higher value (100), but this means of
course your garbagecollecti on of stale sessionfiles will run every times.

from php.ini
; Percentual probability that the 'garbage collection' process is started
; on every session initialization.
session.gc_prob ability = 1

2) Build it yourself
Maybe a better approach would be to:
a) store in a db-table the phpsessid with a username and a timestamp.
b) every time you do something in the session, update the timestamp in the
db for this user.
c) when you need the 'online visitors', just delete old records from the
table, and what is left are possible online users.

I think the second approach is better.

Good luck,
Regards,

Erwin Moller

PS: In Java we have this beautifull HttpSessionBind ingListener, but I am not
aware of similar functionality in PHP.
Jul 17 '05 #3
I use a session variable to hold the users login name - if that var
isn't == "" then someone has signed in - to see who, I just read the
session var.

To determine if they are still online I use a MySQL table called
online and on every web page I make a call to update that table with a
timestamp - each user has a record in the online table so I can tell
who is online based on the timestamp - I use 10 minutes - if the
timestamp is within 10 minutes of now() then I assume they are still
online.

On Thu, 23 Oct 2003 06:11:47 GMT, "szar" <no**@nowhere.n et> wrote:
Anyone know a good way to check if someone is signed in, has a session
going, etc.? I could have a signed in field that updates from 'yes' to 'no'
when they sign out, but that wouldn't work well when the session times out
or they just close the browser. Thx.
Steve.


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
6483
by: MiniDisc_2k2 | last post by:
Okay, here's a question about the standard. What does it say about unsigned/signed mismatches in a comparison statement: char a = 3; unsigned char b = 255; if (a<b) Now what's the real answer here? If a is converted to unsigned, then b>a. But, if b is converted to signed,then a>b. What's the correct coversion (what is the compiler supposed to do?)
8
2248
by: Rade | last post by:
Following a discussion on another thread here... I have tried to understand what is actually standardized in C++ regarding the representing of integers (signed and unsigned) and their conversions. The reference should be 3.9.1 (Fundamental types), and 4.7 (Integral conversions). It seems to me that the Standard doesn't specify: 1) The "value representation" of any of these types, except that (3.9.1/3) "... The range of nonnegative...
14
1586
by: Salad | last post by:
I've always thought that the talking heads, the people that write Access mags, the "gurus" that tout themselves as being the true masters of Access tell MS what they want. How does a lowly real-world developer, not some talking head pundit touter, ever get MS to hear them? Years ago they had something like a Wishlist, but I've always thought that's pretty much a circular file.
17
8029
by: Christopher Dyken | last post by:
Hi group, I'm trying to implement two routines to handle 32x32-bits and 64x64-bits signed integer multiplication on a 32 bits machine in C. It easy to find descriptions of non-signed multiplication, however, I haven't found any good descriptions for the signed counterpart. Does any of you have a good reference for this topic? Thanks in advance,
9
4179
by: dam_fool_2003 | last post by:
For int data type the default range starts from signed to unsigned. If we don't want negative value we can force an unsigned value. The same goes for long also. But I don't understand why we have signed char which is -256. Does it means that we can assign the same ASCII value to both signed and unsigned. That means the ASCII value can be represented with a type of signed char and also unsigned char? For example int main(void) {
10
15666
by: tinesan | last post by:
Hello fellow C programmers, I'm just learning to program with C, and I'm wondering what the difference between signed and unsigned char is. To me there seems to be no difference, and the standard doesn't even care what a normal char is (because signed and unsigned have equal behavior). For example if someone does this: unsigned char a = -2; /* or = 254 */
10
3315
by: =?iso-8859-2?B?SmFuIFJpbmdvuQ==?= | last post by:
Hello everybody, this is my first post to a newsgroup at all. I would like to get some feedback on one proposal I am thinking about: --- begin of proposal --- Proposal to add signed/unsigned modifier to class declarations to next revision of C++ programming language
7
5049
by: somenath | last post by:
Hi All, I am trying to undestand "Type Conversions" from K&R book.I am not able to understand the bellow mentioned text "Conversion rules are more complicated when unsigned operands are involved. The problem is that comparisons between signed and unsigned values are machine- dependent, because they depend on the sizes of the various integer types. For example, suppose that int is 16 bits
6
6459
by: Kislay | last post by:
Consider the following code snippet unsigned int i=10; int j= - 2; // minus 2 if(i>j) cout<<"i is greater"; else cout<<"j is greater"; Since i is unsigned , j is greater . I know why , but vaguely . Can
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.