Hello everyone,
First, let me just say thanks to all of those who have helped me in the past. While this is my first post, I've found plenty of answers in the past by searching through questions that others have asked. This time however, I can't find exactly what I'm looking for.
Here's the deal, I work on a PHP based menu system for my company. The menu system allows users to run reports, change settings on our Linux box, etc. My problem here is with the reports. Some of them can take 10-15 minutes to run. That's a long time to force the user to sit and watch a "Loading..." screen. What I'd like to do is somehow send the report process to the background.
So far, I've been able to redirect the user's browser to a different page, and let them continue on with the menu. However, as soon as they select another option that requires PHP code (which is about 95% of all options in the menu), the browser will sit there and do nothing until the original PHP process is complete. Here is the code I've been using:
ignore_user_abort(true);
echo <<< html9
<script language="javascript">
var thisURL = document.location.href
{
var URL = document.location.href;
var QStr = '';
URL = URL.toLowerCase();
if ( URL.indexOf('?') != -1)
{
var Idx = URL.indexOf('?');
var Len = URL.length;
QStr = URL.substring(Idx, Len);
}
{
var indexnew = (/web/bg.php' + QStr);
window.location=indexnew
}
}
</script>
html9;
flush();
An idea that I've been toying with is popping a new browser window, and then using "session_regenerate_id()" to create a new session id for that window. I could run the process in that window, and then have javascript minimize the window, all the while the original browser window would be free to do whatever. Would this work? If not, how can I go about letting the user continue on in the menu, and not have to wait for the reports to finish?