Forum Moderators: coopster

Message Too Old, No Replies

timed functions

maybe cgi or not?

         

smarty

5:27 pm on Dec 16, 2003 (gmt 0)

10+ Year Member



On the web page, parameters will be set and submitted through a web form. The data will be added into MySQL database. Right after the submission, the 'function first()' will start. When the 'function first()' has ended, a time counter will be started.
Now it will be checked whether the database table 'actions' field 'result' value is '1' (indicates a change in the database) or not. If true, the 'function second()' will be started immediately. If the value was not '1', it will be checked again when the time counter started earlier reaches 45 sec and if the value is '1' at that time, the 'function second()' will be started and if the value is '0' the 'function third()' will be started (skipping the 'function second()').
When the 'function third()' ends, again a time counter will be started. If the time counter reaches 45 sec, the value of the field 'result' will be checked again and if it is '0', 'function forth() will start and that would end the process.

The solution has to be browser independent, meaning that although it will be launched by submitting a form, it will continue running on its own in the server when the browser is closed or crashes etc. I assume CGI should be
used for doing that.

Server has PHP 4.3.3 and MySQL 4.0.16 installed.

I assume that I need a protection agains double submitting too - people cklicking the submit button too many times etc.

mogwai

5:44 pm on Dec 16, 2003 (gmt 0)

10+ Year Member



Hi,

I don't quite understand why you would want to do this, can you give more details? Surely when your insert statement has executed and returned you can assume that it has either completed or failed, why would you want to check again in 45 seconds?

You can likely achieve it using the PHP sleep() function combined with your database insert/update/select functions.

smarty

6:01 pm on Dec 16, 2003 (gmt 0)

10+ Year Member



Example:

function first() include mail() (send mail to “ONE GROUP” devices)
function third() include mail() (send mail to “SECOND GROUP” devices)
function fourth() include mail() (send mail to Administrator)

If the “ONE GROUP” cannot respond to MySQL, maybe “SECOND GROUP” devices can.

smarty

4:44 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



How to use exec(), shellexec(), ignore_user_abort() on this project?