473,788 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session counting


Hello all,

There is system. Users are logging , working and logout.
Suppose, 5 users are working and Admin wants to find out no. of users
working on system with their name ?

How to find this ?

Thanks in advance.
Dec 18 '07 #1
2 1550
pradeep wrote:
There is system. Users are logging , working and logout. Suppose, 5
users are working and Admin wants to find out no. of users working on
system with their name ?
Depends. Are you on a shared server? Are you using PHP's standard sessions?

If yes to both, then the answer is no! (Well, it could be done, but not
reliably.)

Best option is to write your own session handler -- i.e. the piece of code
which deals with saving and restoring session data -- easier than it
sounds! Store the session data in a database, and then you can simply use
a SQL COUNT(*) query to find the number of open sessions.

See: http://uk2.php.net/manual/en/functio...ve-handler.php

The comment from maria at junkies dot jp, dated 09/12/07 is a reasonably
good starting point.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 10 days, 21:16.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
Dec 18 '07 #2
pradeep wrote:
Hello all,

There is system. Users are logging , working and logout.
Suppose, 5 users are working and Admin wants to find out no. of users
working on system with their name ?

How to find this ?

Thanks in advance.
In addition to what Toby said, you can do it even on a shared host, but
neither is reliable. They work fine if the user logs off, but not if he
just shuts down his browser.

To do it without your own session handler, you need to keep a list of
logged-in people. Probably a flag in the database would be most
appropriate.

But you'll also need a timestamp field to tell when they did log in, and
if they've been logged in longer than the session time limit, you need
to clear the flag. Maybe easier would be just a timestamp - if it
exists, the person is logged in. When the person logs out, clear the
timestamp.

Then you need a program (i.e. a cron job) to go through the list on a
regular basis to clear users who have been logged in to long.

But none of this is very accurate. They really only tell you who logged
on - not whether they were still active.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Dec 18 '07 #3

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

Similar topics

2
6504
by: Phil Powell | last post by:
http://codewalkers.com/seecode/75.html http://www.webkreator.com/php/concepts/counting-users-online-with-php.html The following two URLs illustrate different approaches to the idea of showing "how many users online" issue. I am looking at two different sites where I am looking into implementing this type of script; one that has mySQL and one that has no db access of any kind; both use PHP 4.1.
27
7131
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
3
4461
by: wetchman | last post by:
Hey, I've got a little counter program written to log individual hits to a page without counting the same person twice. The problem is, it's counting the same people twice. Here's the logic: 1) Check the session to see if they've been counted. 2) If they have not been counted: - save their referrer/IP info - flag their session to say they're counted
2
3347
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of the user. I want that cookie should get deleted when user closes the browser without signing out. I think it is done in global.asa file . But i don;t know how to do it?
1
321
by: Lloyd Taylor | last post by:
Hello, I am creating a web application and I would like to adopt similar session/user management to my online banking system. I was wondering if anyone could give me a few pointers. 1. When my session is about to expire a notice is displayed counting the time down, what is the best way of of trying to re-create this??
20
2566
by: p175 | last post by:
Hi people, I have a stored procedure that creates many Global temporary session tables. Into each of these tables go the results of various processing using relational division all keyed and based on a common ID from an ID session table. So we can have various session tables with differing results but if they contain records, they are all keyed to the common ID. My problem now however is how do I report the overall findings of the
14
2934
by: Martin Walke | last post by:
Hi all, Is there any limit to the number of session variables a site can have? And is that affected by global.asa at all? The reason why i ask is that i have a relatively simple site that relies on about 40 sesion variables and a mixture of vbs and js files. One of the session variables is an id number that gets incremented to point to the next piece of data to be displayed. This variable is initialised on the first page of the site...
2
1696
by: Ken Varn | last post by:
I am a little confused on how Session Timeout is handled. Does the session timeout counter get reset on each postback or is it always counting down until it expires regardless of postbacks? -- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc.
9
2818
by: cendrizzi | last post by:
Hi all, I've read some stuff on this but can't seem to come up with a solution that works right. I have a semi-mature (yet very large and robust) internal web application that currently only works with one window open at a time. Maybe I'm abusing the use of $_SESSION but I have data entry processes split up in several steps (which is required since depending on what was put before determines what pages will be shown after). To store...
7
2011
by: Mangler | last post by:
Here is the process on the site before I ask the question: User logs in session is created based on username and userid user edits a record in the db a hidden field with the userid session is inserted in the db to show who edited the record
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
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
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
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
8995
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...
0
6750
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
5403
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...
1
4074
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
3677
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.