Jump to content

Help: get online time


clown[NOR]

Recommended Posts

well... I've tried to make this work now, but it wasn't as easy as I thought... I'm trying to see how long a user has been logged in... this is what I've got so far...

 

<?php
function getOnlineTime($user,$sid,$axx)
{
	dbConn();
	$cTime = strtotime(date("H:i:s"));
	$query = "SELECT * FROM `news_users` WHERE email ='".$user."' AND sid ='".$sid."' AND access ='".$axx."' LIMIT 1";
	$result = mysql_query($query);
	if (!$result) { die(mysql_error()); }

	$dbField = mysql_fetch_assoc($result);

	$logintime = strtotime($dbField['logintime']);
	$time_online = $logintime-$cTime;

	$time_online = date("H:i:s", $time_online);
	$time_online = explode(":", $time_online);

	return $time_online[0].'t '.$time_online[1].'m '.$time_online[2].'s';

}
?>

 

but it kinda didn't work as I hoped.. :) what it does now is that it counts down something :) i'm not sure what it's counting down to...  any ideas on how to fix my problem?

 

Thanks In Advance

- Clown

Link to comment
https://forums.phpfreaks.com/topic/51517-help-get-online-time/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.