opalelement Posted May 11, 2009 Share Posted May 11, 2009 I have a GD script that, if $_GET rebuild == true, it will regenerate the image based on database data. If not, it gets a saved image and displays that. All of that works perfectly. The problem I am having is that I want one script that will run all of my rebuilds at once. However, when require()ing or include()ing the scripts that generate the image, it tells me that it cannot find the file. It can find them when I don't have ?rebuild=true, but then it doesn't update them. The code: <?php $maps = array(); if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if (is_file($file) && !in_array($file, array("error_log", "update.php"))) { $maps[] = "$file"; } } closedir($handle); } for($i = 0; $i < count($maps); $i++) { echo "$maps[$i]"; include($maps[$i] . "?rebuild=true"); } ?> Is there any other way to do this? I want it all in one file so I can update all my images with one cron job. This means I can't use <img src="map url"> because the cron job would close it off before the php scripts were done, since the cron-called script is finished. Quote Link to comment https://forums.phpfreaks.com/topic/157691-requireing-or-includeing-files-with-a-query-string/ Share on other sites More sharing options...
Adam Posted May 11, 2009 Share Posted May 11, 2009 $rebuild = true; include($maps[$i]); Then check the value of $rebuild within the included file... Quote Link to comment https://forums.phpfreaks.com/topic/157691-requireing-or-includeing-files-with-a-query-string/#findComment-831600 Share on other sites More sharing options...
opalelement Posted May 11, 2009 Author Share Posted May 11, 2009 Good idea, I forgot that variables can pass through. Thanks:) Quote Link to comment https://forums.phpfreaks.com/topic/157691-requireing-or-includeing-files-with-a-query-string/#findComment-831610 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.