Hi, you'l have to bear with me, because it's a little obscure.
The first page on my website is "index.php"
which initializes some SESSION variables (site language, user name & password, login datetime etc.). This page then calls via php "include" the main webpage
(Html+PHP), called "startpage.php"
, which is dynamic since it can be generated in 3 languages (default + 2).
On the main webpage ("startpage.php"
) - there are flags for the 2 other languages, which, when clicked, change the SESSION['lang'] variable
accordingly thru a PHP script and then try to redraw the main webpage ("startpage.php"
) in the selected language.
My folder structure is the following (htdocs being "/"):
/source/xxx.html & yyy.php - all .html and .php files
In order to draw the main webpage, I use "include" in index.php
(the first file that starts everything). And then I use "include" again in the PHP script
that has changed the SESSION['lang'] variable
. But this time, the PHP script
is in a subfolder of index.php (/source), AND I GET AN ERROR or a CORRUPTED MAIN PAGE, depending on how I refer to "startpage.php" i.e. "/source/startpage", "source/startpage" or just "startpage".
I am sure that if I'd put all "code" pages (html & PHP) in the same place - i.e. in htdocs, I wouldn't get the errors. But that's risky from a SECURITY point of view, isn't it ?
If you understood all the above
, the questions are:
Is using "include" or "require" PHP functions the right way to do it ?
If it is, why isn't it working ?
If it isn't, what should I do ?
Thanks a lot in advance.