Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/268680-determine-correct-patch/
Share on other sites

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.

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.