Hi
We have some pages that already use a database connection and include several functions files.
I have tried including global.php but whatever method (chdir etc) I use gives errors..
Here's what I have on the page so far..
Code:
<? session_start();
require("db/connectguidedb.php");
require("cobrand.php");
require("checklogin.php");
require("../cms/functions/listings.php");
require("functions.php");
require("../member/functions/premiummembers.php");
//rest of page here
?>
The checklogin file has:
Code:
$cwd = getcwd();
chdir("../forum/");
require('global.php');
chdir($cwd);
this gives:
Code:
Warning: chdir(): No such file or directory (errno 2) in /home/xxxx/public_html/whatson/checklogin.php on line 4
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxxx/public_html/whatson/functions.php on line 43
Invalid Request
I have also tried the following in checklogin.php:
Code:
$intDirPos = strpos($_SERVER['SCRIPT_NAME'],"/",1);
$strDirectoryCurrent = substr($_SERVER['SCRIPT_NAME'], 1, strpos($_SERVER['SCRIPT_NAME'],"/",1)-1);
if($intDirPos!==false)
{ // we are calling from a sub directory
chdir("../forum");
include("global.php");
chdir("../".$strDirectoryCurrent);
}else{ // we are calling from the web root directory
chdir("./forum");
include("global.php");
chdir($cwd);
}
Which gives the following error:
Code:
Warning: main(../cms/functions/listings.php): failed to open stream: No such file or directory in /whatson/guide.php on line 5
Anybody got any ideas - its a total arse!