everisk Posted April 23, 2008 Share Posted April 23, 2008 Hi, I have quite a long script that need some time processing, but I need to output some message to Flash file before the script ends. Currently, I can output the message but Flash will not get the message unless the script ends (which is too long for user to wait). I googled the answer and tried to add it into my script. But ,with my script, when the page stops loading (or the loading bar stops) it doesn't continue the rest of the script. Please help A portion of my code <?php include "conn.php"; ignore_user_abort(true); //Receives values from Flash Form $from_email = strtolower(trim($_REQUEST['from_email'])); $from_name = strtolower(trim($_REQUEST['from_name'])); $to_email = strtolower(trim($_REQUEST['to_email'])); $user_message = trim($_REQUEST['user_message']); //user type message $from_name = iconv("UTF-8", "TIS-620", $from_name); $user_message = iconv("UTF-8", "TIS-620", $user_message); //some process //--------insert all value into raw_input table--------// $raw_to_email = strip_tags(fullclean($to_email)); $sql = "insert into raw_input (from_email, from_name, to_email, user_message, fdate, message) values ('$from_email', '$from_name', '$raw_to_email', '$user_message', '$tdate', $message)"; mysql_query($sql); $response = "writ=Ok&writing=Ok"; header("Connection: close"); header("Content-Length: " . mb_strlen($response)); echo $response; //to output to flash before the script ends flush(); ob_flush(); flush(); ob_flush(); flush(); ob_flush(); test_fuc(); function test_fuc() { print "test get called<br />"; sleep(10); print "script continued"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.