473,408 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How can i detect the actions of person visiting my site ?

I have seen in this site that you can find out wether the person is online or offline or if he is online on which page he is ? How can I do that for my site ?
Feb 27 '08 #1
12 1401
hsriat
1,654 Expert 1GB
I have seen in this site that you can find out wether the person is online or offline or if he is online on which page he is ? How can I do that for my site ?
I don't know about this site, but if you have to do something like this.
  • Make a table, say current_activities, in the database with three fields, user_id, status and last_activity.
  • When a user logs on to your site, update the status field.
  • Every time a user visits a page, you may be doing a cookie validation thing. While you do that, update the last_activity field.
  • And when a user logs out of your site, turn off the status flag.

Thats what I can suggest. Actual algorithm may be something else.
Feb 27 '08 #2
Markus
6,050 Expert 4TB
I don't know about this site, but if you have to do something like this.
  • Make a table, say current_activities, in the database with three fields, user_id, status and last_activity.
  • When a user logs on to your site, update the status field.
  • Every time a user visits a page, you may be doing a cookie validation thing. While you do that, update the last_activity field.
  • And when a user logs out of your site, turn off the status flag.

Thats what I can suggest. Actual algorithm may be something else.
That's good logic, and exactrly how i'd go about it.

But what if the user doesn't log out and just exists the browser?

You'd be smart to take the time of the users last activity, and when showing a page which shows said users last activity, check this time in your database with the current time, and if it is greater than, say, 1hour, declare the user offline and update the status accordingly.
Feb 27 '08 #3
hsriat
1,654 Expert 1GB
That's good logic, and exactrly how i'd go about it.

But what if the user doesn't log out and just exists the browser?

You'd be smart to take the time of the users last activity, and when showing a page which shows said users last activity, check this time in your database with the current time, and if it is greater than, say, 1hour, declare the user offline and update the status accordingly.

Yeah, you are right :)

Actually I didn't think about in deep. :p

Then we can also do one change. Instead of status flag, use time only. Don't update the status field with YES or NO, but update it with time. After one hour (or how much required), if user not logged out, declare him logged out. Else if he actually logs out, clear the time.
Feb 27 '08 #4
Markus
6,050 Expert 4TB
Yeah, you are right :)

Actually I didn't think about in deep. :p

Then we can also do one change. Instead of status flag, use time only. Don't update the status field with YES or NO, but update it with time. After one hour (or how much required), if user not logged out, declare him logged out. Else if he actually logs out, clear the time.
Indeedy, doody.

See what we can do when we work together?
It's beautiful!
Feb 27 '08 #5
hsriat
1,654 Expert 1GB
Indeedy, doody.

See what we can do when we work together?
It's beautiful!

Yeah, it is...

PS: What's doody?
Feb 27 '08 #6
Markus
6,050 Expert 4TB
Yeah, it is...

PS: What's doody?
Urm, well... it just rhymes :D
Feb 27 '08 #7
hsriat
1,654 Expert 1GB
Urm, well... it just rhymes :D

oh... ok.. thats goody doody!
Feb 27 '08 #8
Markus
6,050 Expert 4TB
oh... ok.. thats goody doody!
This thread has officially been h i j a c k e d

:P
Feb 27 '08 #9
harshmaul
490 Expert 256MB
Thats the third thread hijak that i've witnessed in two days!
Feb 27 '08 #10
hsriat
1,654 Expert 1GB
Thats the third thread hijak that i've witnessed in two days!
I know, and the first one was mine!!

So taking revenge here. :D
Feb 27 '08 #11
Markus
6,050 Expert 4TB
Thats the third thread hijak that i've witnessed in two days!
You better watch it!
Or we'll be hijacking you
*evil*
Feb 27 '08 #12
ronverdonk
4,258 Expert 4TB
Could we please all get back to the problem here?

moderator
Feb 27 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
24
by: dE|_ | last post by:
I have started looking into scripts for screen size detect with the intention of using them to pick from a number of CSS style sheets tailored to the size. Is there a good reason why this is not...
18
by: sebastian | last post by:
Can this be done without client-side scripting? I thought sessions might be the answer but after some testing found that sometimes the old session data remained even after the user left the site...
7
by: Peter | last post by:
Hello I have an UTF string, how can i detect what language it is? thanks from Peter (cmk128@hotmail.com)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.