Re: [PHP] time in php
> hi. > how I compare two times with php? > 12:23:50 - 13:12:00 = ??? Convert them to timestamps (unix timestamps) and subtract the two. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Time in php problem....
I think you can do all of these using the session. In your log on script, after validating his uid and pwd, insert a row with current timestamp and his id. Either during log off or session close insert another row with uid and current time stamp. (This part I never done) Rest is to manipulate the values the log table information. (may be develop a admin screen, which manipulates the log table) Hope this helps. Ng Kok Chun wrote: > hi... i need some help... > > currently i doing web base programming ( econsultant )using php, apache and mysql as >well... now i facing a problem which i need : > 1) get time when consultant log on > 2) get time when consultant log off > 3) calculate how long for the specified consultant been log on to the web > 4) accumulate all the time everyday > 5) then multiple accumulate with working rate ( X ). > 6.) finally output to web ( html form ) > > pls help ! > thanks ! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Time in php problem....
All I can tell is that there's a pain of calculating when the user leaves the site. Let's say his connection drops. What's then? How do you know he didn't spend on that page 7 hours? I think you should have a file included in every page he visits which, using sessions, adds the TimeStamp to the database. Then you can see - if session exists means he continues, if not then this is the first time he is in. Something like that. Put all in the database and play with it later-on. As of the rest, I think you can do it all. The only concern is for you to accept that his last record is a hit of a page (or log-of button) and not his closing window. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Ng Kok Chun [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 5:11 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; "mailto:webmaster"@dark-library.com; [EMAIL PROTECTED] Subject: [PHP] Time in php problem hi... i need some help... currently i doing web base programming ( econsultant )using php, apache and mysql as well... now i facing a problem which i need : 1) get time when consultant log on 2) get time when consultant log off 3) calculate how long for the specified consultant been log on to the web 4) accumulate all the time everyday 5) then multiple accumulate with working rate ( X ). 6.) finally output to web ( html form ) pls help ! thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Time in php problem....
almost didn't respond to this given the wide dissemination and the broad nature of the question can't be done with any accuracy. you could, create a session or uservariable... have that transmitted with a screen refresh, or anytime your consultant moves within the site resetting an internal timestamp. failure to retransmit via refresh or movement within a specified time would cause expirey, have a function that logs the expirey date and perform your other functions from there (thats the easy part) This doesn't prevent your consultant from keeping a browser window open so that it can refresh. You could use javascipt code on your page with a popup window where your consultant would have to press submt to be logged in as online every so often, but the annoyance factor would be absurd. In short, try pounding out a base from whence to work from... you are likely to get specific responses to specific questions or problems... what you are currently asking for is a prepackaged solutions. Dave -Original Message- From: Ng Kok Chun [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:11 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; "mailto:webmaster"@dark-library.com; [EMAIL PROTECTED] Subject: [PHP] Time in php problem hi... i need some help... currently i doing web base programming ( econsultant )using php, apache and mysql as well... now i facing a problem which i need : 1) get time when consultant log on 2) get time when consultant log off 3) calculate how long for the specified consultant been log on to the web 4) accumulate all the time everyday 5) then multiple accumulate with working rate ( X ). 6.) finally output to web ( html form ) pls help ! thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]