Helpful Information
 
 
Category: vB3 General Discussions
[RELEASE] Calling In Outter Files Into .PHP

Okay, I know I had this problem, and then fixed it, so I'm passing it along, just in case you might want it. :D

Here is a script that allows you to call any .html or .txt files INTO your forums, or any files that are not .shtml so for all your SSI you can use this code to call it into your forum pages. This is also great for people you want to use banner rotators.

#!/usr/bin/perl

###########################################################################
## ##
## The Includer ##
## ------------ ##
## by Jimmy (wordx@hotmail.com) ##
## http://www.smartCGIs.com ##
## ##
## This is a free script, if anyone sold it to you please contact me. ##
## Please DO NOT remove any of the copyrights or links to our site, ##
## they keep this CGI free for everyone. Thanks! ##
## ##
## (c) copyright 2000 The Mp3eCom Network ##
###########################################################################
#
# Instructions:
# ============
# Grab the content of any file and display it using a Javascript tag in the following format:
#
# <script src="/cgi-bin/includer.cgi?../point/to/file.txt"></script>
#
# with file.txt being the file you are grabbing.
# If it's in a different directory, include the full unix path.


$file = $ENV{'QUERY_STRING'};
print "Content-type: text/html\n\n";

if($file eq "/home2/form-kaos/www/insert/menu.html") {
print "document.writeln('<center><font color=red>Includer Error: No File Specified.</font>
');\n";
print "document.writeln('<small>Script by <a href=\"http://www.smartcgis.com\" target=\"_blank\">SmartCGIs.com</a></small></center>');\n";
exit;
}

open(DATA,"$file") || print "document.writeln('<center><font color=red>Includer Error: Could not open $file ($!).</font>
<small>Script by <a href=\"http://www.smartcgis.com\" target=\"_blank\">SmartCGIs.com</a></small></center>');";
@filecontent = <DATA>;
close(DATA);

foreach $line(@filecontent) {
chomp($line);
$line =~ s/\'/\\\'/g;
print "document.writeln('$line');\n";
}


Now copy that into a .txt file, and rename it includer.cgi, set your perl location at the top #/usr/bin/perl (this may be different for some free/pay hosts), upload it, CHMOD 755 (set permissions to 755) and that's it. There is no need to edit this script, calling is done from the code below Now in any page with ANY file extension (html, htm, shtml, shtm, php, php3, cgi, pl, etc..) you include this code:

<script src="/cgi-bin/includer.cgi?../point/to/file.txt"></script>

That will call the page you asked for into the page. DO NOT remove the ../ from the line. Any questions ask them here, and I will be happy to reply!

Credit to: Jimmy (wordx@hotmail.com) for the creaton of this script.

snyx

this could be quite useful for a few things i want to do, thanks.

i was searching for something like that for age thanks

i have add your script to my forum and i have edit my bb code so i have done it like this



is replaced with <script src="/cgi-bin/includer.cgi?../

is replaced with "></script>

but its not work for the moment i will try later but if you see something that i have not see let me know :)

Try this is all else fails:


<script src="http://www.yourname.com/cgi-bin/includer.cgi?../point/to/file.txt"></script>










privacy (GDPR)