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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-27-2007, 05:02 PM   #1
BSleazy
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
BSleazy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 05:03 PM   #2
BradM
Confirmed User
 
Join Date: Dec 2003
Location: 1123,6536,5231
Posts: 3,397
include("filename.php");
BradM is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 05:03 PM   #3
fris
Too lazy to set a custom title
 
fris's Avatar
 
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
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 05:29 PM   #4
BSleazy
Confirmed User
 
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
Alright sweat. Thanks guys.
__________________
icq 156131086
BSleazy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 05:36 PM   #5
Nookster
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.
Nookster is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 05:48 PM   #6
u-Bob
there's no $$$ in porn
 
u-Bob's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
readfile();
u-Bob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 09:50 PM   #7
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
Quote:
Originally Posted by Fris View Post
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
That works...
...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.

Last edited by k0nr4d; 02-27-2007 at 09:52 PM..
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 10:02 PM   #8
tenderobject
Need Designs? 312352846
 
Industry Role:
Join Date: Dec 2004
Location: Somewhere
Posts: 11,687
Quote:
Originally Posted by k0nr4d View Post
That works...
...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.
so whats thebest suntax fo include? iom using this ins some of my sites and it lags it sometimes.
__________________


NEED DESIGNS?!?
tenderobject is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 10:19 PM   #9
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
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.
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 10:56 PM   #10
pornpf69
Too lazy to set a custom title
 
pornpf69's Avatar
 
Join Date: Jun 2004
Location: Brasil
Posts: 15,778
Quote:
Originally Posted by k0nr4d View Post
That works...
...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.
very informative!! thank you for your input!!
pornpf69 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 10:59 PM   #11
spasmo
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].
__________________

Surfers: Go here for hot babes.
spasmo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 11:28 PM   #12
PHP-CODER-FOR-HIRE
Confirmed User
 
Industry Role:
Join Date: Nov 2006
Posts: 1,090
Really only useful if all the sites are on the same server
__________________
PHP-CODER-FOR-HIRE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 11:32 PM   #13
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
Quote:
Originally Posted by spasmo View Post
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].
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
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2007, 11:38 PM   #14
spasmo
Confirmed User
 
Join Date: Dec 2005
Location: Couch
Posts: 2,678
Quote:
Originally Posted by k0nr4d View Post
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
I think you're right. The $_SERVER variables are passed by Apache, aren't they?
__________________

Surfers: Go here for hot babes.
spasmo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:01 AM   #15
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
yeah i believe so
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 08:07 AM   #16
u-Bob
there's no $$$ in porn
 
u-Bob's Avatar
 
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>
u-Bob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 09:14 AM   #17
d00t
Confirmed User
 
Industry Role:
Join Date: Sep 2002
Location: In your mind
Posts: 3,766
Quote:
Originally Posted by u-Bob View Post
Guys, when including static files (without php code), use readfile() instead of include(). </2 cents>
why is that?
d00t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 11:06 AM   #18
borked
Totally Borked
 
borked's Avatar
 
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
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 12:11 PM   #19
u-Bob
there's no $$$ in porn
 
u-Bob's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
Quote:
Originally Posted by d00t View Post
why is that?
cuz it's 15 times faster and uses alot less resources.
u-Bob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 01:09 PM   #20
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
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
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 01:30 PM   #21
HomeFry
Confirmed User
 
HomeFry's Avatar
 
Join Date: Jun 2006
Posts: 1,062
Just use an iframe.
HomeFry is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:01 PM   #22
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
Quote:
Originally Posted by HomeFry View Post
Just use an iframe.
they dotn get indexed by google
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.