Re: [PHP] PHP Timer + Java
At 22:28 11.11.2002, Mohsin Rahman said: [snip] 1) How to pass the STARTTIME only when the START TASK button is pressed? Apprently using echo input type=button value=\Start\ onclick=\window.open('popup.html?clientid=$starttime=strtotime(\now\)$th isclientidprojectid=$thisclientid','TEST','height=200,width=300,resizable=y es,toolbar=no,status=no,menubar=no,scrollbars=no')\; does not pass the unixtime (now) to the popup. You're merging the function call strtotime() into a string - that won't work. The other query parameters seem also not to be correctly identified. Try this: $starttime = =strtotime('now'); $uri = 'popup.html?' . clientid=$thisclientid . projectid=$thisprojectid . starttime=$starttime; echo 'input type=button value=Start', 'onclick=window.open(\'', $uri, '\',\'TEST\',', '\'height=200,width=300,resizable=yes,toolbar=no,', 'status=no,menubar=no,scrollbars=no\')'; 2). Since this is a Java popup, how do I get the close form action back and insert my endtime into the database from the popup? I don't know - this depends on how the Java applet is written. Basically it should issue a request to an URI passing either the time, or the elapsed time, as a parameter. Caution - this would pass the time at the client workstation which might differ considerably from the server time. I'd suggest a solution where the server generates some kind of client token that's passed to the Java applet. The server would then associate this token with what he knows as project start time. Upon hitting the stop button at the client's the applet would just pass back this token, annotated by the action (stop, reset, cancel, whatever). The server would then have a chance to take the appropriate action. 3). How do I mix php in a Java function? You don't. PHP is a server side issue, Java runs at the client's (at least in this scenario). The client browser starts the Java applet on behalf of the HTML code your server-side application outputs. The Java applet can only communicate with the server using URI requests. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Timer + Java
OK.. probably a easy thing, but I am complicating it too much. Here is what I am trying to accomplish. Using PHP4.0.2 and PostgreSQL 7.1. I am creating a time tracking system where a user, based on their login, gets a list of open projects. I have clientid, projectid, description, estimate time, and actual time spent on the project. it is the Actual Time data that I am trying to collect. I give the user a list of all their tasks, and want them to click a FORM BUTTON (can be anything as long as it accomplishes what I am doing) that passes variables like clientid, projectid, startime, description to the popup. What I want to do is use that popup window to show how much time they have spent since the click on START TASK form button is pressed. I then want to show them a running time starting from 00:00:00 upwards. Sort of like a stopwatch. The popup has a STOP/CLOSE link that, when pressed, will update the database with the unixtime stamp of the start and end of the project. I have the 00:00:00 counter going no problem, but the problem I run into: 1) How to pass the STARTTIME only when the START TASK button is pressed? Apprently using echo input type=button value=\Start\ onclick=\window.open('popup.html?clientid=$starttime=strtotime(\now\)$thisclientidprojectid=$thisclientid','TEST','height=200,width=300,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=no')\; does not pass the unixtime (now) to the popup. 2). Since this is a Java popup, how do I get the close form action back and insert my endtime into the database from the popup? 3). How do I mix php in a Java function? Any help and pointers appreciated. Thanks. Mohsin Rahman [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timer
On Fri, 22 Jun 2001 06:41, george wrote: My back is aganist the wall with this one, I have to create a timer . What happens is admin will enter a time say 2 hours in the future this time will be stored in a db as a time stamp then the current time and the timestamp from the db are subtracted from one another and the result is shown as hours minutes and seconds. but I cant get it to work at all any suggestions would be great TIA George This might be the direction you want? ?php $now = time(); //Get current timestamp $then = mktime(0,0,0,7,12,2001); $diff = $then - $now; $ary = getdate($diff); while(list($key, $val) = each($ary)){ echo $key == $valBR; } ? Outputs seconds == 46 minutes == 16 hours == 19 mday == 20 wday == 2 mon == 1 year == 1970 yday == 19 weekday == Tuesday month == January 0 == 1676806 -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I prefer unlined gloves, Tom deferred. -- 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] PHP timer
On Fri, 22 Jun 2001 06:41, george wrote: My back is aganist the wall with this one, I have to create a timer . What happens is admin will enter a time say 2 hours in the future this time will be stored in a db as a time stamp then the current time and the timestamp from the db are subtracted from one another and the result is shown as hours minutes and seconds. but I cant get it to work at all any suggestions would be great TIA George Better than my previous effort :-): ?php $now = time(); //Get current timestamp $then = mktime(0,0,0,6,23,2001); // What you get from the DB $diff = $then - $now; echo Starting with $diff seconds. Check daysBR; $days = floor($diff / 86400); $seconds_left = $diff % 86400; echo Days: $daysBR; echo Seconds remaining: $seconds_leftBR; $hours = floor($seconds_left / 3600); $seconds_left = $seconds_left % 3600; echo Hours: $hoursBR; echo Seconds remaining: $seconds_leftBR; $minutes = floor($seconds_left / 60); $seconds_left = $seconds_left % 60; echo Minutes: $minutesBR; echo Seconds remaining: $seconds_leftBR; ? You might want to add a check on wheter $now is earlier or later that he value in the DB, and act accordingly. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA If you're not confused, you're not paying attention. -- 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]
[PHP] PHP timer
My back is aganist the wall with this one, I have to create a timer . What happens is admin will enter a time say 2 hours in the future this time will be stored in a db as a time stamp then the current time and the timestamp from the db are subtracted from one another and the result is shown as hours minutes and seconds. but I cant get it to work at all any suggestions would be great TIA George -- 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]