Jump to content

logged in time


gish

Recommended Posts

hi phpfreaks

 

I know that the logged in time above would have to use at database but does it use a time() function.

the code I have below must be very wrong i know. right now I get either 0 or 14. All  I want to do right now is when the page refreshes it will tell the user how long they have been on the site. I know I can do this with javascript  but have bigger plans for the outcome that involve php. I just am at a loss to know how to go about it. does anyone have ideas

 

					$current_time = date("H:i:s");
					$_SESSION['session_time'] = $current_time  -  $_SESSION['session_time'];
					echo " Time Logged On:  " . $insert .  $_SESSION['session_time'] . " </span>"  ; 	

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/139485-logged-in-time/
Share on other sites

I have been doing some reading and I have done the following the time keep changing but the int is not working so

is the code below on the right tract

 

				$time=time();
				echo $time;
				// int turns it 	string into a number		
				$num_time  = (int)$time; 					
					$num_time =  $_SESSION['session_time'];
					echo " Time Logged On:  " . $insert .  $_SESSION['session_time'] . " </span>"  ; 

Link to comment
https://forums.phpfreaks.com/topic/139485-logged-in-time/#findComment-729707
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.