Forum Moderators: coopster

Message Too Old, No Replies

Hiding includes

Placing includes below public_html/www

         

russgri

3:13 am on Apr 8, 2004 (gmt 0)

10+ Year Member



I have this config.php file in a folder "data" in the same directory as public_html

<?php
//config.php
$host = "domain.name"; //your domain name
$port = 2082;
$path = "/frontend/x2/mail/doaddpop.html"; //change x2 to your theme.
$cpaneluser = "Cpanel Username";
$cpanelpass = "Cpanel Password";
$authstr = "$cpaneluser:$cpanelpass";

// Defines local variables
$data ="/home/username/data";
$server_inc = $_SERVER["DOCUMENT_ROOT"]."/inc";
?>
//include $server_inc."/header.php";


$server = $_SERVER["DOCUMENT_ROOT"]."/";
?>
[/code]
Here is my index.php

<?php
//index.php
include $data."/config.php";
include $server."setup.php";
include $data."/header.php";
include $data."/right.php";
include $server."content.php";
include $data."/footer.php";
?>

Where is my error?
Newbie here...

tomda

7:02 am on Apr 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Russgri,

If there is an error, let us know what it is?

If there is an error in the path, you can replace include by echo in order to see the path and check if it is correct.

Finally, I am used to write include this way :
include_once ("".$data."/config.php");

Tomda

russgri

3:04 am on Apr 9, 2004 (gmt 0)

10+ Year Member



Hi Tomda.
You ask me to notify you if I found the answer?
Does that mean that there is an error?
One person emailed me that he was not sure that php could access a file below root/www.

Here are the errors.
Warning: main(config.php): failed to open stream: No such file or directory in /home/host2xar/public_html/index.php on line 3

Warning: main(): Failed opening 'config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/host2xar/public_html/index.php on line 3

Help Php gurus.

nostra

1:15 pm on Apr 9, 2004 (gmt 0)

10+ Year Member



$data is unknown in index.php

config.php and index.php have to be in the same directory

so you can require/include now config.php

require("./config.php");