Jump to content

How to execute the file completely ??


d.shankar

Recommended Posts

Hi phpfreaks !

 

This thread may sound a bit crazy but plz to try to help me if you people can.

 

 

Consider i have a website(www.test.com) and i have a big file with lot of operations in a file called test.php

 

plz assume the file has some 2000 lines of code and at the end of the line there is a  insert table operation to make sure that the file has reached the end and all the operatiions above have completed, i.e to make sure if the page was accessed.

 

When a user requests the file from the browser say www.test.com/test.php , the file runs for some 10 seconds to complete the operation.

 

Killer Situation:

So when a user closes the window within 10 seconds , the operations won't get completed , the insert operation does not perform too.

 

 

 

My request is that when the user closes the window within 10 secs, is it possible to make the file run in the server background so that it gets executed fully or are there any means to perform this ???

 

Please let me know if this sounds weird !!!

Link to comment
Share on other sites

I tried like this

 

<?php
ini_set("ignore_user_abort", 1);


sleep(20);



		$to		=	"myself@gmail.com";

		$from = 'adasd@sdfsdf.sdfsf';

		$subjectx = "testing";

		$body="Mail sent";		

		$headers  = 'MIME-Version: 1.0' . "\r\n";

		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

		$headers .= $from ."\r\n";



		mail($to,$subjectx,$body,$headers);

?>

 

 

wheni run this file for 20 seconds.. i get the mail.

 

I called this file and immediately closed my browser in 2 seconds but i didnt get the mail :(

 

any suggestions ??

 

 

 

 

 

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.