Jump to content

Run process in the background but stop explorer loading bar


everisk

Recommended Posts

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";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.