FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how to make Php process won't stop after user disconnect.





Philip
I have a problem that like this below.
when i try to process a php that have many2x and big function that about take 1 hours,

like www.google.com/progess.php
but it seem if my browser stop or my connection disconnect that make the progess stoped too also.

i know there is a function settimeout(0);
but it;s still useless if the user disconnect -_-"

is there a way to php process wont stop if a user disconnected ?

thanks,
hexkid
Philip wrote:
is there a way to php process wont stop if a user disconnected ?


http://www.php.net/manual/en/features.connection-handling.php
Philip
so is i am not wrong
just use this function ignore_user_abort();

there is 3 state
ignore_user_abort(0) ;<-- time out and abort / Normal
ignore_user_abort(1) ;<-- abort after disconnect
ignore_user_abort(2) ;<-- abort only if timeout

and for better just using number (2) right ??

thanks
hexkid
Philip wrote:
so is i am not wrong
just use this function ignore_user_abort();

there is 3 state
ignore_user_abort(0) ;<-- time out and abort / Normal
ignore_user_abort(1) ;<-- abort after disconnect
ignore_user_abort(2) ;<-- abort only if timeout

and for better just using number (2) right ??


The state you check with connection_status(); to have the script continue after a user clicked "Stop" execute a
Code:
ignore_user_abort(true);


PS. 2 when interpreted as a boolean is the same as true, so calling ignore_user_abort(2) or ignore_user_abort(true) is the same; but I prefer the last.
Philip
err.. i what happened if there i set settimeout(0); 'unlimted and ignore_user_abort (2); and there is a progess that won;t end ??
hexkid
Philip wrote:
err.. i what happened if there i set settimeout(0); 'unlimted and ignore_user_abort (2); and there is a progess that won;t end ??

Probably the hosting administrator will cancel your account Wink
Philip
hehe, that cannot be. that too cruel ^_^"
btw thanks to hex-kid Smile
Related topics
How To : Secure Your PHP Website
sms jokes
sms jokes
A PHP Script Contest, winner get 100F$
one line securing of php pages (login of users) (user auth)
150 frih to make this SIMPLE script
How to parse a HTML with PHP ?
Windows XP SP3 comming soon
How to Skip a process
new guy needs help
CTFMON What is it
Music that doesnt stop when user is browsing between pages
How to speed up slow PC's?
How to build PHP mail form with Spam protection
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.