We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Dern Include Files...
Topic Started: Nov 21 2007, 04:22 PM (739 Views)
Midnight Umbreon
Member Avatar
Member
[ *  * ]
http://www.tmu.lilting.org/
Any page other than the forums and the index isn't working. The only way I got the index to work is by taking off the URL and just having include/left.php. But I can't do that for the rest of them because they are in different directories. Any ideas? BTW, here's the index source code.
Code:
 
<?php include("include/left.php"); ?>
  <h1>Lorem Ipsum Dummy Text</h1>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus sodales enim in elit. In felis felis, facilisis in, vehicula id, rutrum nec, magna. Cras sit amet enim non dolor pellentesque ornare. Sed interdum. Maecenas   aliquet faucibus massa. Nulla nulla mi, fermentum vitae, accumsan et, dignissim tempus, nisl. Pellentesque euismod. Nunc erat lorem, bibendum non, pulvinar a, malesuada in, ipsum. Nullam hendrerit. Cras turpis mauris, laoreet nec, luctus ultrices, adipiscing sed, ante.<br />
   <br />
<?php include("include/right.php"); ?>
Offline Profile Quote Post Goto Top
 
Dennis
Member Avatar
Member
[ *  *  *  *  *  *  * ]
What is the source code of contactme.php? Or affiliate.php. Any page other than index.php
Offline Profile Quote Post Goto Top
 
Midnight Umbreon
Member Avatar
Member
[ *  * ]
It's the same as the index except with different body text.
Offline Profile Quote Post Goto Top
 
Dennis
Member Avatar
Member
[ *  *  *  *  *  *  * ]
Oh, I see the problem. You can't call a remote address via include. You're using

Code:
 
include("http://www.tmu.lilting.org/include/left.php");


You should be using the server's absolute path to your include file:
Code:
 
include("/home/lilting/public_html/tmu/include/left.php");


A relative path will work as well:
Code:
 
include("include/left.php");
Offline Profile Quote Post Goto Top
 
Midnight Umbreon
Member Avatar
Member
[ *  * ]
Hmm.. It worked before.. Thanks.. I'll try it...
Offline Profile Quote Post Goto Top
 
Dennis
Member Avatar
Member
[ *  *  *  *  *  *  * ]
If you recently switched hosts, that may be why. I believe it is possible for it to be enabled, but most hosts have it disabled for security purposes. I've never heard of include() working remotely before.
Offline Profile Quote Post Goto Top
 
Midnight Umbreon
Member Avatar
Member
[ *  * ]
#### it..
So I can't put http://www.lilting.org/home/lilting/public...nclude/left.php? Just home/lilting/public_html/tmu/include/left.php?
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
This code will work best for you.

Code:
 
for($i=0; $i < count(explode('/', $_SERVER['PHP_SELF']))-2; $i++) {
$dir .= '../';
}
$quote = file($dir .'php-inc/quotes.txt');


It is what I use at www.FearKiller.net to include the random quotes text at the top of every page. How it works is a for() loop runs through the URL of the current page counting how many directories up from the root directory.

All you have to do is edit the text "php-inc/quotes.txt" to accommodate the proper path of the file you are including. Do so as if you were including the file from your web site's root directory.

Reply if you have any problems I can assist you with.
Offline Profile Quote Post Goto Top
 
Midnight Umbreon
Member Avatar
Member
[ *  * ]
Thanks alot, Fearkiller but I've got it to work. Thanks anyway.
Offline Profile Quote Post Goto Top
 
blakeo_x
Member Avatar
I cant believe its not PHP!
[ *  *  * ]
Dennis
November 21, 2007 06:28 PM
I believe it is possible for it to be enabled, but most hosts have it disabled for security purposes. I've never heard of include() working remotely before.

Include function

URL fopen wrappers (allow_url_fopen and allow_url_include) must be enabled. Like you said, most hosts do have it disabled for security reasons because of the ablility to access remote objects, but run them within a local environment.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply