Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Set time of starting
- $time1 = microtime(true);
- /**
- * @return integer max time limit of execution that PMA can use
- */
- function get_maxtime()
- {
- /**
- * Seems hackish lol.
- * Returns value of max_execution_time if safe mode is on
- * else returns value set by set_time_limit
- */
- return (ini_get('safe_mode')) ? ini_get('max_execution_time') :(set_time_limit(5)) ? 5 : 0;
- }
- echo "Started <br />";
- //Set and get the max time of execution
- $maxtime = get_maxtime();
- //Send out maxtime for user to see
- echo "$maxtime <br />";
- for($i=1;$i<10000000;$i++)
- {
- $mytime = $maxtime - (microtime(true)-$time1);
- //Stop working, prepare for clean redirect etc if only 1 second or less is left
- if($mytime <= 1)
- {
- // Do some necessary cleanup. stop outputting download
- // set some notice to show that we have more data to export.
- // redirect to the new export page with data starting with the row next in iteration.
- die("1 second only. ".$i." iterations done");
- }
- }
- //finished successfully
- echo "Ended Sucessfully at: ",$mytime," Seconds";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement