Jump to content


Photo

Config.php Loading but Vars not.


  • Please log in to reply
1 reply to this topic

#1 AbydosGater

AbydosGater
  • Members
  • PipPipPip
  • Advanced Member
  • 435 posts
  • LocationAlways at computer!

Posted 16 September 2006 - 10:20 AM

Hey, Ok I have working on a website, and i have the config file with all my variables written out but when i Require it into my page just before the <html> tag, and im not getting any errors, but later down in my page when i call for any of my variables from the config.php, they dont come up, its like the vars are empty.. oh wait and i will run a script....

<?PHP
	require("http://abydosgaters.com/beneavin/config.php");
	echo "<title>abydos2</title>";
	If (isset($dbhost)){
	echo "$sitename" ;
		}
	else if (empty($sitename)) {
	echo "The var is empty";
		} else {
	echo "The if turned out bad" ;
	};
?>
and i got the result that the var is empty?
Why does that happen if the var is set within the file being required?

__
And while on the topic of config files, On GNU software, like phpBB and SMF, they both have a config.php or settings.php with all the database variables to be included, but with the file permissions set to 777, doesnt that mean anyone can include the file? isnt that unsafe that anyone could require the file from anyones forum and read the variables with the database info? isnt that really unsafe, sorry they probs have some security in place, n00b question.

#Thanks
#Abydosgater
www.abydosgaters.com

Current Project: Blog Application.. Undecided name.. Status: Coming along great.

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 16 September 2006 - 10:24 AM

That's because you entered the full path:
require("http://abydosgaters....vin/config.php");

If you want the vars to also included enter the short path:
require("config.php");

Orio.
Think you're smarty?

(Gone until 20 to November)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users