Jump to content

using includes() from ourside the directory???


bmobm

Recommended Posts

I have a website which is running PHPProbid. I have tried to register on their forums but after 3 weeks of trying i am giving up in the hope that someone else may be able to assist me with my problem.

 

My directory is similer to this:

 

                      ROOT

                        |

                        |

            -------------------

            |            |            |

            |      probid folder  |

            |                        |

            |                  another folder

      another folder

 

example here (this will give you a better idea of what it looks like and what i mean)

 

Any way i want tp put an index file in the ROOT folder which calles files from within the probid folder. i.e. the header and footer and main categories which appear on the left side of the pages.

 

basically i want the index (which will be outside of the probid directory) to look like THIS which is IN the probid directory. But i dont what the log in our register boxes in the main part of the page just what you can see header, left side and Footer.

 

I have tried to link to these pages but i am getting a permissions error and i have tried just about every thing my personal knowledge of PHP can do (which isnt much lol)

 

I realise that i will also need some help with MySQL also as the categories and the login ect work via that but i will sort that once i have managed to make the index with a header, footer and the side bar.

 

If any one can help me out i would be very greatful.

 

Thank you all in advance

Link to comment
Share on other sites

when you visit www.mysite.co.uk its redirected to a sub directory of www.subdirectory.mysite.co.uk

 

i need to call files from www.mysite.co.uk/subdirectory/themes/chosen_theme/ to an index which will be in the ROOT directory which is 1 level up from the subdirectory

 

does this make sense? click HERE for a rough idea of what i mean

Link to comment
Share on other sites

but i thought that would only work from within the directoy the other files which call the files i want reside in.

 

../ i thought meant the directory the files are in and the /folder/folder/file.php path to the one i want?  Does this still work when calling files to a files outside of this directory?

 

To be honest its almost like a chmod prob if you get what i mean. its like the files im trying to call are protected from being called or linked to from out side the probid directory.

 

am i making sense here?

Link to comment
Share on other sites

would it work if i for example took a page from inside the script directory (copied it) and put it in the ROOT directory and then just changed the path to the includes ie include("../subdirectory/themes/chosen theme/file.php") understanding that "../" means the directory the file USING the includes is in

 

Is it possible that the files have some protection to stop them being callef outside of the directory they are intended to be used in?? if si is there a way around this?

Link to comment
Share on other sites

the files i want to include mainly are these files

 

include_once ("config/config.php");

 

include ("themes/".$setts['default_theme']."/header.php");

 

include ("themes/".$setts['default_theme']."/footer.php"); ?>

 

so if my directory for the themes is mysite.co.uk/subdirectory/themes.choosen_theme/file.php

 

and i want to include the files to a document in mysite.co.uk

 

do i change the include to  include ("../subdirectory/themes/".$setts['default_theme']."/header.php");

 

and include ("../subdirectory/themes/".$setts['default_theme']."/header.php");

 

oh ive just noticed something also there is a MySQL query in there aswell isnt there?  for the defult theme.

 

would i need to make any amendments for that to work or should it still work?

Link to comment
Share on other sites

ive just tried this:

 

<?php 
include ("/home/username/public_html/header.php"); 
include ("/home/username/public_html/mainpage.php"); 
include ("/home/username/public_html/footer.php"); 
?>

 

but im getting errors still, as shown below

 

Warning: main() [function.main]: open_basedir restriction in effect. File(/home/username/public_html/header.php) is not within the allowed path(s): (/home/bmobm/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/bmobm/public_html/indextest1.php on line 2

 

Warning: main(/home/username/public_html/header.php) [function.main]: failed to open stream: Operation not permitted in /home/bmobm/public_html/indextest1.php on line 2

 

Warning: main() [function.main]: open_basedir restriction in effect. File(/home/username/public_html/header.php) is not within the allowed path(s): (/home/bmobm/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/bmobm/public_html/indextest1.php on line 2

 

Warning: main(/home/username/public_html/header.php) [function.main]: failed to open stream: Operation not permitted in /home/bmobm/public_html/indextest1.php on line 2

 

Warning: main() [function.include]: Failed opening '/home/username/public_html/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bmobm/public_html/indextest1.php on line 2

 

Warning: main() [function.main]: open_basedir restriction in effect. File(/home/username/public_html/mainpage.php) is not within the allowed path(s): (/home/bmobm/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/bmobm/public_html/indextest1.php on line 3

 

Warning: main(/home/username/public_html/mainpage.php) [function.main]: failed to open stream: Operation not permitted in /home/bmobm/public_html/indextest1.php on line 3

 

Warning: main() [function.main]: open_basedir restriction in effect. File(/home/username/public_html/mainpage.php) is not within the allowed path(s): (/home/bmobm/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/bmobm/public_html/indextest1.php on line 3

 

Warning: main(/home/username/public_html/mainpage.php) [function.main]: failed to open stream: Operation not permitted in /home/bmobm/public_html/indextest1.php on line 3

 

Warning: main() [function.include]: Failed opening '/home/username/public_html/mainpage.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bmobm/public_html/indextest1.php on line 3

 

Warning: main() [function.main]: open_basedir restriction in effect. File(/home/username/public_html/footer.php) is not within the allowed path(s): (/home/bmobm/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/bmobm/public_html/indextest1.php on line 4

 

Warning: main(/home/username/public_html/footer.php) [function.main]: failed to open stream: Operation not permitted in /home/bmobm/public_html/indextest1.php on line 4

 

Warning: main() [function.main]: open_basedir restriction in effect. File(/home/username/public_html/footer.php) is not within the allowed path(s): (/home/bmobm/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/bmobm/public_html/indextest1.php on line 4

 

Warning: main(/home/username/public_html/footer.php) [function.main]: failed to open stream: Operation not permitted in /home/bmobm/public_html/indextest1.php on line 4

 

Warning: main() [function.include]: Failed opening '/home/username/public_html/footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bmobm/public_html/indextest1.php on line 4

 

by the way what does  open_basedir restriction in effect mean?

Link to comment
Share on other sites

Ok ,ive got it narrowed down to this:

 

it seems that the scripts require a defined constant and i need to ensure that other files are also included, which isnt happening at the moment.

so i will need to somehow make sure those other files are in the proper directory for inclusion by the header/footer, either by manually editing the header/footer, or moving the files to a different directory, which could then break even more stuff. lol

 

somebody on another forum suggested that

Your best bet would probably be to make sure your new directory structure matches the themes (or whatever it looks like you're trying to integrate) directory structure, aside from it being in a subdirectory.

 

but being new to all this i dont actually know what he means. BUT ive come up with a plan.............. what do you think about this idea????

 

 

would it work if i copied the probid directory structure (just the files and folders which the includes are trying to call) to the ROOT. in the same structure as they are in the probid directory. thus making the index (which is in the ROOT) think its still inside the probid directory, and if i only call the files which i need for the index then this shouldnt use up to much space.......... is this right? but would i need to modify any settings for the database or will it still be able to find the database from either directory? (i think thats a question for the MySQL forum lol. )

 

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.