![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
PHP include question
How would I make a little file that I can add links to that shows up on 100's of sites.
The purpose is to just be able to update one file instead of 100's. Get it?
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Dec 2003
Location: 1123,6536,5231
Posts: 3,397
|
include("filename.php");
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,372
|
i do this with a lot of my sites i just edit 1 link file say links.inc
<?include "http://www.domain.com/links.inc"?> on any site you want to do it, and all you have to do is update that one links.inc file
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
|
Alright sweat. Thanks guys.
__________________
icq 156131086 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed IT Professional
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
|
Yep, the above examples will work for what you need. But I advise that if you use a database in said include do NOT use .inc for the file extension, and like always keep the dbase connection info out of the domain root directory.
![]()
__________________
The Best Affiliate Software, Ever. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
there's no $$$ in porn
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
|
readfile();
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
Quote:
...if you want your sites to all load really slowly and use more system resources then they need to... Theres lots of methods, best one being @include('/var/www/domain.com/links.php'); <-- never name anything .inc because that would read plain text. if you decide at some point to include some php code into the links file, if its named php it will be parsed if someone accesses it directly instead of showing your code to the person using .inc. Don't include() over http as thats going to be very if your network lags. If you have to do it across several servers, setup a cron job that will download the links file to the other servers, or rsync, or scp, or whatever you want. If all your domains are on one server, include using the absolute path.
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Need Designs? 312352846
Industry Role:
Join Date: Dec 2004
Location: Somewhere
Posts: 11,687
|
Quote:
__________________
NEED DESIGNS?!? |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
include('/absolute/path/to/file'); is the best syntax. You can put a @ in front of the include if you want to supress warnings if the file doesn't exist or is unreadable from that location due to open_base_dir restrictions.
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Too lazy to set a custom title
Join Date: Jun 2004
Location: Brasil
Posts: 15,778
|
Quote:
__________________
Do you need cheap, fast and reliable porn website hosting? Host Head is the way to go!! Asian Gay Special | Live on MSN - Live Webcam Chat | Live Adult Webcam Performances | MY SWEET BLACKS LIVE ON CAM Pukka Tranny | Tattooed Shemales | She's A He | Menu Porno | Porn Performances | All Chubby MY ICQ# 169833797 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Dec 2005
Location: Couch
Posts: 2,678
|
I use:
<? include("$_SERVER[DOCUMENT_ROOT]/includes/include_filename.php"); ?> or in cases where it's an absolute path (as stated above) I omit the $_SERVER[DOCUMENT_ROOT]. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Industry Role:
Join Date: Nov 2006
Posts: 1,090
|
Really only useful if all the sites are on the same server
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
That works too, but keep in mind (im not POSITIVE of this, but 90% sure) that the $_SERVER variables don't work if you are coding for CLI
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Confirmed User
Join Date: Dec 2005
Location: Couch
Posts: 2,678
|
I think you're right. The $_SERVER variables are passed by Apache, aren't they?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
yeah i believe so
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
there's no $$$ in porn
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
|
Guys, when including static files (without php code), use readfile() instead of include(). </2 cents>
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 |
Confirmed User
Industry Role:
Join Date: Sep 2002
Location: In your mind
Posts: 3,766
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#18 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
just add this to a header file:
<?php $pathArr = pathinfo(__FILE__); ini_set('include_path', ini_get('include_path').':'.$pathArr['dirname'].'/includes'); ?> then you're all set - you can forget about worrying to add the full pathname - add any file to includes/ directory then include them simply with include('filename.php');
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 |
there's no $$$ in porn
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
readfile() is actually alot more then 15 times faster, uses far far far less ram, but like he said only works on static files with no php code in them
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 |
Confirmed User
Join Date: Jun 2006
Posts: 1,062
|
Just use an iframe.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |