GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php include() alternative? (https://gfy.com/showthread.php?t=1046473)

roly 11-19-2011 09:42 AM

php include() alternative?
 
hi

i want to include a file (it's just a bit of javascript) from domainA into a php page on domainB (all on the same server). to do this i have to have allow_url_include = on in my php.ini which i believe is a big security risk. has anyone got any alternative solutions that are safer,?

the include is just so i can test various popups over 100's of sites by just changing the javacript in the one file. so i would be grateful for any other simple solutions too.

thanks in advance

stocktrader23 11-19-2011 09:43 AM

iframes?

woj 11-19-2011 09:45 AM

Why are you including it with php? just use a script tag with src='xxxxx'...

Avalana 11-19-2011 09:46 AM

Not sure about: require_once();

roly 11-19-2011 09:49 AM

Quote:

Originally Posted by woj (Post 18571368)
Why are you including it with php? just use a script tag with src='xxxxx'...

because the the bit of code i am calling is a javascript with src="xxx" as well and i'm assuming you can't nest it?

woj 11-19-2011 09:50 AM

Quote:

Originally Posted by roly (Post 18571376)
because the the bit of code i am calling is a javascript with src="xxx" as well and i'm assuming you can't nest it?

you probably can but hard to really say without knowing exactly what you are trying to do...

Brujah 11-19-2011 09:52 AM

using curl?
Code:

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.domainA.com/');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($ch);
curl_close($ch);
echo $contents;


roly 11-19-2011 09:52 AM

Quote:

Originally Posted by stocktrader23 (Post 18571366)
iframes?

no that doesn't seem to work

raymor 11-19-2011 09:54 AM

You want to include the server path to the file, not the URL. So something like:
include ('../../othersite.com/public_html/stuff.inc');

Symlinks on the server can simplify that.
If suexec is preventing you from doing the include, suexec a more serious security hole than fopen_url, as bad as fopen_url is.


The above is if you have to include() instead of doing:

script type="text/javascript" src="http://somesite.com/cool.js"

u-Bob 11-19-2011 09:57 AM

Quote:

Originally Posted by roly (Post 18571364)
allow_url_include = on in my php.ini which i believe is a big security risk.

mostly a huge waste of resources if both sites are on the same server.

Quote:

the include is just so i can test various popups over 100's of sites by just changing the javacript in the one file.
1. use readfile() instead of include() as the contents of the file won't need to be parsed for php code.
2. readfile("/full/path/to/whereever/u/put/thefile/file.js");

Brujah 11-19-2011 09:59 AM

Quote:

Originally Posted by raymor (Post 18571388)
You want to include the server path to the file, not the URL. So something like:
include ('../../othersite.com/public_html/stuff.inc');

Symlinks on the server can simplify that.
If suexec is preventing you from doing the include, suexec a more serious security hole than fopen_url, as bad as fopen_url is.


The above is if you have to include() instead of doing:

script type="text/javascript" src="http://somesite.com/cool.js"

Ah, I didn't catch the "same server" bit. Ray's right, you can use a server path to the files in domainA.com's path instead then.

roly 11-19-2011 11:33 AM

thanks guys for the help it's appreciated, i'm off out now, but i'll have a play around with those tomorrow and report back.

thanks again


All times are GMT -7. The time now is 12:47 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123