Martyn
USER UNDER INVESTIGATION - DO NOT TRADE
Registered: 17th Oct 03
Location: Luton
User status: Offline
|
How many hours in total you've spend on CS. I think that would be pretty cool if ya could!
Martyn..
|
DanielJ
Member
Registered: 21st Nov 01
Location: gwent, south wales
User status: Offline
|
na but iv been on here 2 yrs constant so alot of hours
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
We couldn't do this accurately because of the inherent limitations in HTTP, sorry.
|
Martyn
USER UNDER INVESTIGATION - DO NOT TRADE
Registered: 17th Oct 03
Location: Luton
User status: Offline
|
no problems Ian. I was just thinking, cause I think I've spent most of my year on hear
|
waynep
Member
Registered: 20th Apr 02
Location: london
User status: Offline
|
i could probaly make sum in like this
maybe u start off with a query like this ( i duno how your tables are set up) but im guessing like this ? :
ALTER TABLE user ADD timeonline int(10) NOT NULL DEFAULT '0'
then the function would be sumhin like
function dotimeonline($timeonline) {
$days = floor($timeonline / 86400);
if($days == 0) {
$ftime = "";
} elseif($days == 1) {
$ftime = "$days Day, ";
} else {
$ftime = "$days Days, ";
}
$tothours = $days * 86400;
$newhours = $timeonline - $tothours;
$hours = floor($newhours / 3600);
$ftime.= "$hours Hours, ";
$totmin = (($hours * 3600) + ($days * 86400));
$newmin = $timeonline - $totmin;
$minutes = floor($newmin / 60);
$ftime.= "$minutes Minutes, ";
$totsec = (($hours * 3600) + ($minutes * 60) + ($days * 86400));
$seconds = $timeonline - $totsec;
$ftime.= "$seconds Seconds Online";
return $ftime;
}
|
Martyn
USER UNDER INVESTIGATION - DO NOT TRADE
Registered: 17th Oct 03
Location: Luton
User status: Offline
|
yer good idea m8 up 2 you and Ian though m8
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
corsa-crazy, thats a wild approximation.
|
waynep
Member
Registered: 20th Apr 02
Location: london
User status: Offline
|
thanks of course i could output these functions and intergrate to users info etc etc
|
Trotty
Member
Registered: 22nd Feb 01
Location: Bristol
User status: Offline
|
Yup. If someone comes online for 1 minute, and then closes the PC down or whatever, surely that'll still log the user as here for the full 20mins yes?
|
waynep
Member
Registered: 20th Apr 02
Location: london
User status: Offline
|
no ! u could set this
$inactivetime = 5; // Configure Time Out Time Here in Minutes!
$factivetime = $inactivetime * 60;
$newtime = time() - $csuserinfo[lastactivity];
if($newtime < $factivetime) {
$DB_site->query("UPDATE user SET timeonline=timeonline+$newtime WHERE userid=cs user id'");
}
[Edited on 28-10-2003 by corsa-crazy]
|
Martyn
USER UNDER INVESTIGATION - DO NOT TRADE
Registered: 17th Oct 03
Location: Luton
User status: Offline
|
cool
|
broster
Premium Member
Registered: 6th Dec 02
Location: Drives: E39
User status: Offline
|
and i know exactly what that means! looks funky tho!
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
No no no!
HTTP is inherently stateless. You will *never* accurately tell how long someone has been at a web site. Session tracking used in this message board, other web apps, indeed *any* client-server environment using that protocol is mere hack that *assumes* you're going to stick around for a set length of time.
The code you have pasted does nothing more than manipulate a few variables and write this approximation to the database.
If nothing else, thats an extra DB query when we're trying to make the site *more* efficient and responsive, not less!
|
Richie
Member
Registered: 3rd Dec 02
Location: Newport, Wales
User status: Offline
|
stop whinging and fix up Ian
Martyn, invest in a stopwatch ffs
|
IntaCepta
Member
Registered: 25th Mar 02
Location: Mill Hill East, Greater London
User status: Offline
|
HTTP isn't stateful like ftp.
Once u request and recieve a response from the server, thats it. The server will never know if the client is still viewing the page.
there is no way of knowing whether or not the client is still viewing the page.
and like ian said u don't wanna be having queries coming from left, right and center!
|