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.

 

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 09-17-2012, 05:00 AM   #1
EN1GMA
Confirmed User
 
EN1GMA's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 1,251
Another PHP little question

Hello guys,

Maybe someone can help me again with a PHP question.

I have WEBSITE A and WEBSITE B

In WEBSITE A I created a php file and I display the content on my index.php using this code:
PHP Code:
<?php include 'block/content.php'?>
Now I want to display the exactly same file/content in WEBSITE B, for that I'm using this code:
PHP Code:
<?php include '/home/username_website_a/public_html/block/content.php'?>
But I got the error:
Code:
Warning: include(/home/username_website_a/public_html/block/content.php) [function.include]: failed to open stream: Permission denied in /home/username_website_b/public_html/index.php on line 45

Warning: include() [function.include]: Failed opening '/home/username_website_a/public_html/block/content.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username_website_b/public_html/index.php on line 45
The idea is to edit just one file and display changes in both websites.
But Im a newbie and I dont know If this is possible.

Can someone help me please? :-)
Thanks!!
EN1GMA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 09-17-2012, 05:28 AM   #2
Antokas
Confirmed User
 
Industry Role:
Join Date: Sep 2012
Posts: 41
Hi,

try
PHP Code:
<?php include '../username_website_a/public_html/block/content.php'?>
or
PHP Code:
<?php include '../../username_website_a/public_html/block/content.php'?>
work for me
Antokas is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 09-17-2012, 05:54 AM   #3
adult-help
Confirmed User
 
Industry Role:
Join Date: Mar 2008
Posts: 2,450
i think you should also check if you have safe_mode and open_basedir off or on..
adult-help is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 09-17-2012, 06:59 AM   #4
EN1GMA
Confirmed User
 
EN1GMA's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 1,251
Thank you for your replies mates!

adult-help, I have:

open_basedir: no value
safe_mode: off

Do I need to put both of them on? Or just one of them? If yes, which one?
And is secure to put them on?
EN1GMA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 09-17-2012, 02:08 PM   #5
xxxtubers
Confirmed User
 
xxxtubers's Avatar
 
Industry Role:
Join Date: Jun 2012
Location: Earth
Posts: 152
With this code you get the same error?

PHP Code:
 <?php include '../../username_website_a/public_html/block/content.php'?>
__________________
Best Webcam Affiliate Cam Traffic Profits
xxxtubers is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 09-25-2012, 07:49 PM   #6
pornsprite
Confirmed User
 
pornsprite's Avatar
 
Industry Role:
Join Date: Dec 2009
Location: Texas
Posts: 1,643
The first thing you should do is prove to yourself that you have the right path to the file you want to include by checking it on the command line. Try typing this to if you a good response.

"ls -l /home/username_website_a/public_html/block/content.php". If you don't receive an error you've got the right path if an error is returned you need to get find the correct path.

I would worry about .. or ../.. because it looks like you are using a full path. You would only need to those if you are using relative paths.

php includes always makes more sense to me when I write it like this
<?php include("/home/path/to/file/I/want.php"); ?>

I use double quotes in case I want to use variables that way the variable get interpolated
__________________
Go Fuck Yourself
pornsprite is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 09-25-2012, 10:11 PM   #7
porkbrothersdotnet
Confirmed User
 
porkbrothersdotnet's Avatar
 
Industry Role:
Join Date: Aug 2011
Posts: 131
Check you file permissions inside the directory

/home/username_website_a/public_html/block/
block should be 755 or 777. 777 gives the outside would access to any file that is in there.

What I did in the past with a similar issue was to use an external readfile statement.

<? readfile("http://path A/index.php"); >

Edit the code on site B Insert the above statement in place of your statement that would normal display your output in side B. Any changes made on site A will automatically show up on site B.

Give it a shot.
__________________
Just Porn!
porkbrothersdotnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 10-20-2012, 12:59 PM   #8
supersexysnow
Registered User
 
Industry Role:
Join Date: Dec 2011
Posts: 22
php includes!

Website B needs this adding:
<?php include("hxxp://WebsiteA/want.php"); ?>

that should do it!
supersexysnow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 10-20-2012, 03:13 PM   #9
robber
Web Developer
 
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
If they are two different users and PHP has been setup to restrict you to your own directory, the easiest way to have it work is to park the domain for website b onto website a then you can use relative references and also pay for one set of hosting

Good Luck

Rob
robber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 10-20-2012, 03:30 PM   #10
livexxx
Confirmed User
 
livexxx's Avatar
 
Industry Role:
Join Date: May 2005
Location: UK
Posts: 1,201
Does
<?php include '/home/username_website_a/public_html/block/content.php'; ?>
work in website A as well ?
__________________
http://www.webcamalerts.com for auto tweets for web cam operators
livexxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



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.