MySQL_Narb Posted September 23, 2012 Share Posted September 23, 2012 config.php contains the code below, which checks the existence of the install/index.php $domain = $_SERVER['HTTP_HOST']; if(file_exists($domain.'/install/index.php')) die('test'); This works for domain.com/install/index.php But what if it was: domain.com/test/install/index.php Do note config.php is on multiple path. I can't put a fixed path like "../install/index.php", as it wouldn't work on directories further up or down that includes it. Quote Link to comment https://forums.phpfreaks.com/topic/268680-determine-correct-patch/ Share on other sites More sharing options...
darkfreaks Posted September 23, 2012 Share Posted September 23, 2012 if(file_exists($domain.$_SERVER['REQUEST_URI'])) die('test'); Quote Link to comment https://forums.phpfreaks.com/topic/268680-determine-correct-patch/#findComment-1380181 Share on other sites More sharing options...
MySQL_Narb Posted September 23, 2012 Author Share Posted September 23, 2012 if(file_exists($domain.$_SERVER['REQUEST_URI'])) die('test'); I'm not quite sure how this helps me. This doesn't check if install/index.php exists. ;/ Quote Link to comment https://forums.phpfreaks.com/topic/268680-determine-correct-patch/#findComment-1380196 Share on other sites More sharing options...
darkfreaks Posted September 23, 2012 Share Posted September 23, 2012 //getting absolute URL if it exists in the install file under any other folder as long as it is in install folder if(file_exists($domain.'../install/index.php')) die('test'); Quote Link to comment https://forums.phpfreaks.com/topic/268680-determine-correct-patch/#findComment-1380203 Share on other sites More sharing options...
Christian F. Posted September 23, 2012 Share Posted September 23, 2012 Your problem is that you don't have the config.php or the install.php files in any set location. That means you'll have to scan through the entire file three, starting at the web root, to find the install.php file. Then you'll have to verify that it's actually the right install file, and not some other (unrelated) PHP script. Worst part is, you'll have to do this for every page load. I hope you'll agree with me when I say that this is an extraordinarily bad idea. Move the files to a specific location within the projects root, then you have a solid reference point. Never mind what the domain is, or what the path to the project's web root is in the browser. As long as those two files have a static location within that root, you can check for the install.php file's existence. Also, don't include the config.php from anywhere in your project. Keep your entrance files (such as index.php etc) in your web root. For the same reasons as above. Quote Link to comment https://forums.phpfreaks.com/topic/268680-determine-correct-patch/#findComment-1380271 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.