johnnyk Posted August 4, 2006 Share Posted August 4, 2006 Does this have anything to do with PHP? Maybe not. Maybe it doesn't make sense at all.[code]<?phprequire('/web/directory/file.inc');require('/web/differentdirectory/file2.inc');?>[/code][u]file.inc[/u]<?php$a = 'whatever';?>[u]file2.inc[/u]<?phpecho $a;?>So the problem is that file2.inc will not echo "whatever" (as if $a isn't set). If I did the same kind of thing within the /web/ folder, it works fine. I hope I'm making sense. Quote Link to comment Share on other sites More sharing options...
Caesar Posted August 4, 2006 Share Posted August 4, 2006 Where is the file calling it, in relation to the include file? One level up? In another folder? Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 4, 2006 Share Posted August 4, 2006 I have just done a testI have a directory set up/folder1/file1.inc/folder2/file2.inc/inc.phpfile1.inc contains<?$a = "testing";?>file2.inc contains<?echo $a;?>inc.php contains<?require("folder1/file1.inc");require("folder2/file2.inc");?>I load the page and I get testingSo there is nothing wrong that i could seeusing require, if the file did not include (wrong dir or something) there will be an error Quote Link to comment Share on other sites More sharing options...
johnnyk Posted August 4, 2006 Author Share Posted August 4, 2006 [quote author=Caesar link=topic=102929.msg409250#msg409250 date=1154652505]Where is the file calling it, in relation to the include file? One level up? In another folder?[/quote]I don't think I understand your question, but I'll try to answer.Here's how it looks:The file that is including the other 2 is /home/username/cron/main.phpfile1.inc is /home/username/public/includes/file1.incfile2.inc is /home/username/public/webmaster/includes/file2.incI know that main.php includes both correctly, but the variables set in file1.inc is not accessible in file2.inc Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 4, 2006 Share Posted August 4, 2006 ahhh, it should be in the public htm folder mate Quote Link to comment Share on other sites More sharing options...
johnnyk Posted August 4, 2006 Author Share Posted August 4, 2006 The problem with that, though, is that if someone finds out the location of main.inc, they could run the cron, and that would be bad. I'm using a host and it's not like I can put the cron behind a htpasswd protected folder or anything.Also, why does it need to be in /public/? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.