[PHP] timer in php-cli

2004-03-01 Thread nobody
Hello,

I'm writing a php irc bot. I've come up to the situation where I need a
timer for  processing different data in a "special" way. I've searched the
archive of the list but I didn't found nothing helpful (I can't use
JavaScript here, neither cron).
If I use for(;;) or sleep(); the whole script stops (php is not
multithread:(). Eventually I've come up with some ideas about ticks, but
didn't get to finished it my head. So, any ideas?

And is php5 going to be multithreaded? If not, when?:)

--
best wishes,
Strahil Minev,
http://sourceforge.net/users/phuncky/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Timer and submit button

2003-11-21 Thread David T-G
Frank --

...and then Frank Tudor said...
% 
% I am trying to create a timer tha would prevent someone from
% clicking submit until the timer reaches zero.

1) Javascript is your only hope to disable clicking through, as suggested
by the other responders.

2) It can still be defeated.  How important is it to keep them and why?

3) If you want a set amount of time you could just put in a refresh for
some length of time, but that would then whisk the page out from under
the surfer -- and you'd still have the problem of managing to come
through too early.

4) I can't think of any way you can reliably keep someone on a page for a
given time, but if you want to ensure that they can't go forward you
might make the next link require a magic key which you magically decode
to a time stamp (based on server time of course) some distance future
from when it was sent.  Note that this will require decryption as well as
encryption, since if the click didn't come in at exactly the right time
the server's encryption to check would be different and not just
"greater".


HTH & HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Timer and submit button

2003-11-21 Thread RT
On Fri, 2003-11-21 at 10:51, Frank Tudor wrote:
> I am trying to create a timer tha would prevent someone from
> clicking submit until the timer reaches zero.
> 
> THe reason is to keep an individual on a page for a certain
> amount of time.
> 
> Does anyone know the best way to do this?
> 
> PHP?  Javascript?
> 
> Any examples?
> 
> Frank
> 
> __
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Javascript only.
-- 
"I have a photographic memory. I just forgot the film" --Unknown
=
Ryan Thompson
[EMAIL PROTECTED]
http://osgw.sourceforge.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Timer and submit button

2003-11-21 Thread CPT John W. Holmes
From: "Frank Tudor" <[EMAIL PROTECTED]>

> I am trying to create a timer tha would prevent someone from
> clicking submit until the timer reaches zero.

JavaScript.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Timer and submit button

2003-11-21 Thread Frank Tudor
I am trying to create a timer tha would prevent someone from
clicking submit until the timer reaches zero.

THe reason is to keep an individual on a page for a certain
amount of time.

Does anyone know the best way to do this?

PHP?  Javascript?

Any examples?

Frank

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] timer problem

2003-02-22 Thread John W. Holmes
> Just a little curious. Is there any other way other than cron to do
> this. Is it possible to run a PHP script in an endless loop and when
the
> clock strikes, run another script?

Yeah, I think so, but it'd be worth the effort to just learn cron. You
can use set_time_limit() to zero and run your loop and do your stuff.
Not sure how that is for performance, though...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] timer problem

2003-02-22 Thread Siddharth Hegde
Just a little curious. Is there any other way other than cron to do
this. Is it possible to run a PHP script in an endless loop and when the
clock strikes, run another script?

- Sid

> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 9:40 PM
> To: 'Michael Gaab'; [EMAIL PROTECTED]
> Subject: RE: [PHP] timer problem
> 
> > i want to automate some activities by date.  on a certain date i
want
> to
> > do
> > some specific processing. the application is web based using apache.
i
> > guess
> > i would need some way of calling the program daily to see if "today
is
> the
> > day."  thread/daemon?  any suggestions appreciated.
> 
> Use cron  on *nix, or Task Scheduler if on Windows.
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
> today. http://www.phparch.com/
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] timer problem

2003-02-22 Thread John W. Holmes
> i want to automate some activities by date.  on a certain date i want
to
> do
> some specific processing. the application is web based using apache. i
> guess
> i would need some way of calling the program daily to see if "today is
the
> day."  thread/daemon?  any suggestions appreciated.

Use cron  on *nix, or Task Scheduler if on Windows. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] timer problem

2003-02-22 Thread Michael Gaab
hi.

i want to automate some activities by date.  on a certain date i want to do
some specific processing. the application is web based using apache. i guess
i would need some way of calling the program daily to see if "today is the
day."  thread/daemon?  any suggestions appreciated.

mike



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Timer + Java

2002-11-12 Thread Ernest E Vogelsinger
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 "onclick=\"window.open('popup.html?clientid=$starttime=strtotime(\"now\")&$th
>isclientid&projectid=$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 '';

>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

2002-11-11 Thread Mohsin Rahman
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 "";

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[4]: [PHP] timer on sessions?

2002-07-17 Thread Asmodean

J> So under the time() call, comparing it to a simple numerical value such as
J> "300" it knows that you are talking about 300 seconds?  Is that because it
J> is a unix timestamp?  I previously tried using date("s") to give me the
J> seconds from today's date then tried the compare, so using time() will work
J> better.  Thanks a ton.
J> Jas

Yes. time() returns a UNIX timestamp (currently a 10-digit number)
representing the number of seconds since a certain date (sometime in
1972).

-- 
Best regards,
 Asmodeanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: Re[2]: [PHP] timer on sessions?

2002-07-17 Thread Jas

So under the time() call, comparing it to a simple numerical value such as
"300" it knows that you are talking about 300 seconds?  Is that because it
is a unix timestamp?  I previously tried using date("s") to give me the
seconds from today's date then tried the compare, so using time() will work
better.  Thanks a ton.
Jas
"Asmodean" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> J> I am not able to test from this machine so please tell me if I am right
or
> J> wrong on this:
> J> $tmp = time();
> J> $tme = time() - 5*60;
> J> session_register('tmp');
> if ($tmp >>= $tme) {
> J> echo 'Time has not reached 5 minutes, session still valid';
> J> } else {
> J> echo 'Timer has reached 5 minutes, you will need to log back in to
> J> continue.'; }
>
> J> "Asmodean" <[EMAIL PROTECTED]> wrote in message
> J> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> J> Not sure how to go about setting up a function to parse the date,
hour,
> >> J> minutes, seconds, take the seconds and register them in a session
var,
> J> then
> >> J> do a check on the session var (seconds) vs. the seconds var + 5*60
(or
> J> 5
> >> J> minutes) to time out the session and force the user to log back in.
My
> >> J> problem is finding the correct way to check the seconds in php.  Any
> J> help or
> >> J> pointers is appreciated.
> >> J> Jas
> >>
> >> time() will give you a UNIX timestamp. Use it to do the math.
> >>
> >> --
> >> Best regards,
> >>  Asmodeanmailto:[EMAIL PROTECTED]
> >>
>
> Let's assume you've set your session timestamp (assume it's called
> $session_time) to time() at the time of login. Now, in the script...
>
> if ((time() + 300) > $session_time) {
>
> }
>
> This would be a check to see if the session is still valid. Timewise.
>
> --
> Best regards,
>  Asmodeanmailto:[EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re[3]: [PHP] timer on sessions?

2002-07-17 Thread Asmodean

J>> I am not able to test from this machine so please tell me if I am right or
J>> wrong on this:
J>> $tmp = time();
J>> $tme = time() - 5*60;
J>> session_register('tmp');
if ($tmp >>>= $tme) {
J>> echo 'Time has not reached 5 minutes, session still valid';
J>> } else {
J>> echo 'Timer has reached 5 minutes, you will need to log back in to
J>> continue.'; }

J>> "Asmodean" <[EMAIL PROTECTED]> wrote in message
J>> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>> J> Not sure how to go about setting up a function to parse the date, hour,
>>> J> minutes, seconds, take the seconds and register them in a session var,
J>> then
>>> J> do a check on the session var (seconds) vs. the seconds var + 5*60 (or
J>> 5
>>> J> minutes) to time out the session and force the user to log back in.  My
>>> J> problem is finding the correct way to check the seconds in php.  Any
J>> help or
>>> J> pointers is appreciated.
>>> J> Jas
>>>
>>> time() will give you a UNIX timestamp. Use it to do the math.
>>>
>>> --
>>> Best regards,
>>>  Asmodeanmailto:[EMAIL PROTECTED]
>>>

A> Let's assume you've set your session timestamp (assume it's called
A> $session_time) to time() at the time of login. Now, in the script...

if ((time() + 300) >> $session_time) {

A> }

A> This would be a check to see if the session is still valid. Timewise.

A> -- 
A> Best regards,
A>  Asmodeanmailto:[EMAIL PROTECTED]


Wrong. My fault. ;)

It's...

if (time() > $session_time + 300) {

}

Sorry.


-- 
Best regards,
 Asmodeanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re[2]: [PHP] timer on sessions?

2002-07-17 Thread Asmodean

J> I am not able to test from this machine so please tell me if I am right or
J> wrong on this:
J> $tmp = time();
J> $tme = time() - 5*60;
J> session_register('tmp');
if ($tmp >>= $tme) {
J> echo 'Time has not reached 5 minutes, session still valid';
J> } else {
J> echo 'Timer has reached 5 minutes, you will need to log back in to
J> continue.'; }

J> "Asmodean" <[EMAIL PROTECTED]> wrote in message
J> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> J> Not sure how to go about setting up a function to parse the date, hour,
>> J> minutes, seconds, take the seconds and register them in a session var,
J> then
>> J> do a check on the session var (seconds) vs. the seconds var + 5*60 (or
J> 5
>> J> minutes) to time out the session and force the user to log back in.  My
>> J> problem is finding the correct way to check the seconds in php.  Any
J> help or
>> J> pointers is appreciated.
>> J> Jas
>>
>> time() will give you a UNIX timestamp. Use it to do the math.
>>
>> --
>> Best regards,
>>  Asmodeanmailto:[EMAIL PROTECTED]
>>

Let's assume you've set your session timestamp (assume it's called
$session_time) to time() at the time of login. Now, in the script...

if ((time() + 300) > $session_time) {

}

This would be a check to see if the session is still valid. Timewise.

-- 
Best regards,
 Asmodeanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] timer on sessions?

2002-07-17 Thread Jas

I am not able to test from this machine so please tell me if I am right or
wrong on this:
$tmp = time();
$tme = time() - 5*60;
session_register('tmp');
if ($tmp >= $tme) {
echo 'Time has not reached 5 minutes, session still valid';
} else {
echo 'Timer has reached 5 minutes, you will need to log back in to
continue.'; }

"Asmodean" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> J> Not sure how to go about setting up a function to parse the date, hour,
> J> minutes, seconds, take the seconds and register them in a session var,
then
> J> do a check on the session var (seconds) vs. the seconds var + 5*60 (or
5
> J> minutes) to time out the session and force the user to log back in.  My
> J> problem is finding the correct way to check the seconds in php.  Any
help or
> J> pointers is appreciated.
> J> Jas
>
> time() will give you a UNIX timestamp. Use it to do the math.
>
> --
> Best regards,
>  Asmodeanmailto:[EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] timer on sessions?

2002-07-17 Thread Asmodean

J> Not sure how to go about setting up a function to parse the date, hour,
J> minutes, seconds, take the seconds and register them in a session var, then
J> do a check on the session var (seconds) vs. the seconds var + 5*60 (or 5
J> minutes) to time out the session and force the user to log back in.  My
J> problem is finding the correct way to check the seconds in php.  Any help or
J> pointers is appreciated.
J> Jas

time() will give you a UNIX timestamp. Use it to do the math.

-- 
Best regards,
 Asmodeanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] timer on sessions?

2002-07-17 Thread Jas

Not sure how to go about setting up a function to parse the date, hour,
minutes, seconds, take the seconds and register them in a session var, then
do a check on the session var (seconds) vs. the seconds var + 5*60 (or 5
minutes) to time out the session and force the user to log back in.  My
problem is finding the correct way to check the seconds in php.  Any help or
pointers is appreciated.
Jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Timer

2002-07-16 Thread Thomas \"omega\" Henning

How i know when 2 mins ellapsed?
"Kevin Stone" <[EMAIL PROTECTED]> wrote in message
013f01c22cee$b3e17110$6501a8c0@kevin">news:013f01c22cee$b3e17110$6501a8c0@kevin...
> Store a timestamp in a file.  When the bot is activated retrieve the old
> timestamp and calculate the difference between then and how.  Store that
> value in another file or database.  Update the file with a fresh
timestamp.
> -Kevin
>
> - Original Message -
> From: "Thomas "omega" Henning" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 16, 2002 11:22 AM
> Subject: [PHP] Timer
>
>
> > Is this possible:
> >
> > Im making a bot in PHP and i need a timer. Lets say noone ses anything
for
> > 2mins in the channel after that the bot ses something. And if the bot
> > recieves an msg the timer clears. Is this possible 2 be done?
> >
> > Thomas "omega" Henning
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Fw: [PHP] Timer

2002-07-16 Thread Kevin Stone

Store a timestamp in a file.  When the bot is activated retrieve the old
timestamp and calculate the difference between then and how.  Store that
value in another file or database.  Update the file with a fresh timestamp.
-Kevin

- Original Message -
From: "Thomas "omega" Henning" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 16, 2002 11:22 AM
Subject: [PHP] Timer


> Is this possible:
>
> Im making a bot in PHP and i need a timer. Lets say noone ses anything for
> 2mins in the channel after that the bot ses something. And if the bot
> recieves an msg the timer clears. Is this possible 2 be done?
>
> Thomas "omega" Henning
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Timer

2002-07-16 Thread Thomas \"omega\" Henning

Is this possible:

Im making a bot in PHP and i need a timer. Lets say noone ses anything for
2mins in the channel after that the bot ses something. And if the bot
recieves an msg the timer clears. Is this possible 2 be done?

Thomas "omega" Henning




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP timer

2001-06-22 Thread David Robley

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 :-):

";
$days = floor($diff / 86400);
$seconds_left = $diff % 86400;
echo "Days: $days";
echo "Seconds remaining: $seconds_left";
$hours = floor($seconds_left / 3600);
$seconds_left = $seconds_left % 3600;
echo "Hours: $hours";
echo "Seconds remaining: $seconds_left";
$minutes = floor($seconds_left / 60);
$seconds_left = $seconds_left % 60;
echo "Minutes: $minutes";
echo "Seconds remaining: $seconds_left";
?>

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]




Re: [PHP] PHP timer

2001-06-22 Thread David Robley

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?

 $val";
}
?>

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]




[PHP] PHP timer

2001-06-21 Thread george

  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]




Re: [PHP] timer in PHP

2001-04-11 Thread Plutarck

I'm guessing it's either for a Quiz script or an Auction script.

If you want to make it easy on yourself, use a database to store the
starting time (when the timer "starts") and what time the test/auction
should end. When someome makes a submission, get the time stored in the
database and see if the person's submission is within the timelimit (check
if the current time is less than the finish time).

If the current time is within 2 minutes of the ending time, then take the
ending time, add 5 minutes to it, and then store it.

If you try to do this all in a sort of real-time, you're only making it hard
on yourself and it's more or less impossible to do (without killing yourself
in resources, anyway).

Doing it with a database, once you get it working in the first place, may
even be considered trivial. You may be pleasantly surprised...unless you
can't use a database :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""george"" <[EMAIL PROTECTED]> wrote in message
9b1p05$t6c$[EMAIL PROTECTED]">news:9b1p05$t6c$[EMAIL PROTECTED]...
> I need to have a time running and after a certain time it will not allow
> you to submit anything else,  on top of that if someone makes an entry
with
> less than 2 minutes to go the time must be extended by 5 minutes.
>  I really am at a loss how to do this.
>  Can it be done.
>
> 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]
>



-- 
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] timer in PHP

2001-04-11 Thread Chris Lee

there is no sure way, but using cookies/sessions you can make something that will 
*work* . assign the user a session_id, every time the user makes an entry add a value 
to the db, 

session_id = $SessionID
next_time = time() + 120

every time you make an entry, check to make sure that next_time < time() if it is then 
proceed, else update next_time = time + 300;

If you need a code example email me, I'll whip something up :)


-- 

 Chris Lee
 [EMAIL PROTECTED]



""george"" <[EMAIL PROTECTED]> wrote in message 
9b1p05$t6c$[EMAIL PROTECTED]">news:9b1p05$t6c$[EMAIL PROTECTED]...
I need to have a time running and after a certain time it will not allow
you to submit anything else,  on top of that if someone makes an entry with
less than 2 minutes to go the time must be extended by 5 minutes.
 I really am at a loss how to do this.
 Can it be done.

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]



--
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] timer in PHP

2001-04-11 Thread george

 I need to have a time running and after a certain time it will not allow
you to submit anything else,  on top of that if someone makes an entry with
less than 2 minutes to go the time must be extended by 5 minutes.
 I really am at a loss how to do this.
 Can it be done.

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]