[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 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]