|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
problem with database driven php whos online stats
alright I really can't figure out why this won't work. The biggest issue is that it is a script integrated into a membership tutorial from devarticles that was deleted (it was ben rowes old script, I believe). well the online function doesn't work! It seems to be adding users as they are there, and deleting them as a new one is added, and I don't understand why. So it always says one user online/0 guests... and I'm always the current user at the site. I have other users tell me they experience the same issue... I thought it may have been that it deletes the user from online if there are one or less users on the site (and that seems like a flaw since wouldn't it never reach two users..?) but if I get rid of that code it doesn't remove them from online... I hope this is understandable enough.
well i could post the php here, but I fear it would be too long, so how about a zip file.... and then i shall dump my db table. PHP Code:
__________________
hey it's the CHARKING |
|
#2
|
|||
|
|||
|
any help?
|
|
#3
|
||||
|
||||
|
I'd consider getting rid of the if $show <=1 and changing the deletion so that it deletes where session time is greater than the timeout. This'd keep the db clean without causing the problem you note.
|
|
#4
|
|||
|
|||
|
thank you for your help! this has been bothering me sooo much and I knew that was the problem but when I took that away it simply kept building the database up, anway, is this what would work?
PHP Code:
|
|
#5
|
|||
|
|||
|
wait SESSION_LENGTH is a constant variable isn't it... so that won't work will it... would I jsut write if($_SESSION >= $timemax)?
I am not too familiar with sessions |
|
#6
|
||||
|
||||
|
Looks like $timeMax is being set to now minus SESSION_LENGTH (currently 20 minutes), so you'd need to delete from online where dateAdded is less than $timeMax. I think I've got that right -- I always get turned around when screwing with dates like this. To test, just set SESSION_LENGTH in line 19 to something like .5 or .1 so that the expiration happens a lot more quickly. Then keep hitting pages and seeing if your hits drop out.
|
|
#7
|
|||
|
|||
|
Oh yes, I thought that that was what I needed... would this do?
PHP Code:
It seems to be working; and I also noticed I had this code elsewhere in the view who's online page, which may have been causing problems. I'll let you know if I have any more problems, but so far it seems great. thank you. |
|
#8
|
||||
|
||||
|
I think that should work, though you shouldn't need the single quotes around $timeMax, its being a number and all.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > problem with database driven php whos online stats |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|