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)
-   -   looking for help with php include please (https://gfy.com/showthread.php?t=666125)

spacedog 10-14-2006 04:56 AM

looking for help with php include please
 
What do I need to do to get the following code to work on pages that do not have the .php extension.. seems it only works when the page is pagename.php, but I need it to work on .shtml, .htm & .html, etc... what can I do?

PHP Code:

<?=file_get_contents("http://www.domain.com/file.htm")?>


spacedog 10-14-2006 05:16 AM

bump.. please help

Adultnet 10-14-2006 05:20 AM

<!--#include file="filename.what ever" -->

spacedog 10-14-2006 05:23 AM

Quote:

Originally Posted by Adultnet (Post 11073594)
<!--#include file="filename.what ever" -->

that don't work either

AnnaSucks 10-14-2006 05:53 AM

Quote:

Originally Posted by spacedog (Post 11073527)
What do I need to do to get the following code to work on pages that do not have the .php extension.. seems it only works when the page is pagename.php, but I need it to work on .shtml, .htm & .html, etc... what can I do?

Do you mean you want to have that code on a page other than .php or you want to include files other than .php? I don't think you can put php ON a .html page, but you sure can INCLUDE a html page on a .php page. If that makes any sense.

This one has always worked for me:

PHP Code:

<?php include "file.php"?>


fris 10-14-2006 05:57 AM

Quote:

Originally Posted by spacedog (Post 11073604)
that don't work either

.htaccess

AddType text/html .shtml .html .inc
AddHandler server-parsed .shtml .html .inc

or if you want html files to be treated as php add this

RemoveHandler .html .htm
AddType application/x-httpd-php .html .htm

spacedog 10-14-2006 04:28 PM

ok..the htaccess thing, I'm lost.. might as well be chinese, don't make sense to me..

the file is .htm, but I can name it .php, whatever, is just a page.. but need to be able to include it externally on other pages, like jaymancash's potd blog plugin, how you use the php include code to get the table to appear on our pages, I'd like to provide the php include code to give to others to have my table show up on their page. I don't want an Iframe or javascript, it has to be php include

GrouchyAdmin 10-14-2006 04:32 PM

You have to do what Fris said.

What that will do (create a file named .htaccess in your index root), and put the content in it, will have it parse all of the listed files as though they were native PHP. Other hacks are more ineligant - however, this will slow you down a bit for static content, not that you'll really notice.

You also don't want to do a PHP include across sites, that allows for cross-scripting. If you want them to force inline, that's one of the few choices, but it's incredibly retarded. See above reasoning.

bl4h 10-14-2006 04:35 PM

put this in your htaccess file

if you wanted to parse html as php do this (though you shouldnt do this)

in .htaccess file

Quote:

AddType application/x-httpd-php .html .htm
heres how you include. Name the file with whatever you want to include something like ass.inc

PHP Code:

<?PHP include 'ass.inc'?>

Including the file remotely? STUPID THING TO DO.

spacedog 10-14-2006 04:36 PM

Quote:

Originally Posted by toonpornblog (Post 11076721)
You have to do what Fris said.

What that will do (create a file named .htaccess in your index root), and put the content in it, will have it parse all of the listed files as though they were native PHP. Other hacks are more ineligant - however, this will slow you down a bit for static content, not that you'll really notice.

You also don't want to do a PHP include across sites, that allows for cross-scripting. If you want them to force inline, that's one of the few choices, but it's incredibly retarded. See above reasoning.

but the php include needs to work externally.. sites that are not my own. I believe the .htaccess only allows this to work on sites on my own server..right?

bl4h 10-14-2006 04:39 PM

Produce an XML file and build a script to parse and display it on external hosts.

You dont use include for external stuff..

spacedog 10-14-2006 04:42 PM

Quote:

Originally Posted by bl4h (Post 11076764)
Produce an XML file and build a script to parse and display it on external hosts.

You dont use include for external stuff..

have you seen jaymancash's potd/motd plugin?

It is a php include., with a full url
this is what I am trying to do, but it's not working on any pages that do not have .php as the extension

GrouchyAdmin 10-14-2006 04:44 PM

Quote:

Originally Posted by spacedog (Post 11076740)
but the php include needs to work externally.. sites that are not my own. I believe the .htaccess only allows this to work on sites on my own server..right?

Well, yeah. If they're trying to put PHP in a non .php file or don't have the types set, it's their own problem with implementation.

If you have to have something work externally with URL wrappers, at least look into readfile.. that won't execute code unless you explicitly eval() it.

bl4h 10-14-2006 04:46 PM

Quote:

Originally Posted by spacedog (Post 11076781)
have you seen jaymancash's potd/motd plugin?

It is a php include., with a full url
this is what I am trying to do, but it's not working on any pages that do not have .php as the extension

well thats just plain stupid. Let me sign up and check this out

spacedog 10-14-2006 04:54 PM

Quote:

Originally Posted by bl4h (Post 11076797)
well thats just plain stupid. Let me sign up and check this out

it works for them, & I want to do the same thing.. their code works on my .htm pages & .php, etc.. but when I create my own page & try to include it, it only works on .php.. maybe I should ask jay

nolaman 10-14-2006 04:59 PM

try using fread()

bl4h 10-14-2006 05:01 PM

Well i dont think theyre using include then if it works in html files. whatever. Its your shit

spacedog 10-14-2006 05:16 PM

Quote:

Originally Posted by bl4h (Post 11076901)
Well i dont think theyre using include then if it works in html files. whatever. Its your shit

yep, it sure looks like a php include..

PHP Code:

 <?=file_get_contents("http://www.jaymancash.com/POTD/Raven-Riley/MTOjEx/150/150/")?>


borked 10-14-2006 11:49 PM

check to make sure URL fopen is enabled on your PHP server, then do what Fris said to have all the local files served as php files.

borked 10-14-2006 11:54 PM

that said, you clients also have to have it enabled.
Have a look at Apache SSI
If you're going to allow remote includes, make sure you configure Apache to disable HTTP PUT methods etc. Otherwise, you could be opening up a big secruity hole for well-crafted remote code to overwrite your files etc. Sure you can allow remote includes, but if you haven't secured the installation, you could be enabling remote writing at the same time.

GrouchyAdmin 10-15-2006 12:17 AM

Quote:

Originally Posted by borked (Post 11078470)
that said, you clients also have to have it enabled.
Have a look at Apache SSI

He's trying to do a remote url open. I've never seen SSI support that, because, well, it's retarded, and wrong. You can't do a <!--#include "http://foo" -->

fris 10-15-2006 04:25 AM

you can do a php include with a full url

bl4h 10-15-2006 04:51 AM

why not do it the right way. Does this POTD change once a day? Why would you include something (have your server connect to a remote host for every single page load) that changes only once a day. fucking christ

put 30 ravin riley pictures in a directory and cycle them at random. same dumb effect

spacedog 10-15-2006 07:14 AM

Quote:

Originally Posted by bl4h (Post 11079417)
why not do it the right way. Does this POTD change once a day? Why would you include something (have your server connect to a remote host for every single page load) that changes only once a day. fucking christ

put 30 ravin riley pictures in a directory and cycle them at random. same dumb effect

You're missing the point here.. I'm not talking about rotating images or tables on my own sites, I am talking about rotating tables/images of MINE to be able to be php included on OTHER PEOPLES pages.. were I disussing my own pages, I would just code right into the page itself, or include with php extension, but since I am trying to have this include work on others pages, the page/table/image being included coming from my domain & hosting, & the php include string being called from a different domain/host.

Certainly there are other various methods of getting a simple potd/motd, etc to work, however, standard potd/motd, etc are only images & links, whereas what I want to accomplish is similar to the method of Jaymancash & some others where the potd/motd etc is enclosed within a table so that there is also text, etc, so that with other webmasters placing the php include on their pages would have my table/image etc being displayed on their sites, but the page/table etc is hosted by me.. get it now?

If I need be fucking with apache, & all this other server admin shit, looks like I need to have someone do it for me as I haven't a friggen idea about any of that, lol.... I did however spend several hours reading about fread, fopen, etc.. so, eventually can figure all this out, I hope :1orglaugh

borked 10-15-2006 08:38 AM

Quote:

Originally Posted by spacedog (Post 11079823)
You're missing the point here.. I'm not talking about rotating images or tables on my own sites, I am talking about rotating tables/images of MINE to be able to be php included on OTHER PEOPLES pages.. were I disussing my own pages, I would just code right into the page itself, or include with php extension, but since I am trying to have this include work on others pages, the page/table/image being included coming from my domain & hosting, & the php include string being called from a different domain/host.

Certainly there are other various methods of getting a simple potd/motd, etc to work, however, standard potd/motd, etc are only images & links, whereas what I want to accomplish is similar to the method of Jaymancash & some others where the potd/motd etc is enclosed within a table so that there is also text, etc, so that with other webmasters placing the php include on their pages would have my table/image etc being displayed on their sites, but the page/table etc is hosted by me.. get it now?

If I need be fucking with apache, & all this other server admin shit, looks like I need to have someone do it for me as I haven't a friggen idea about any of that, lol.... I did however spend several hours reading about fread, fopen, etc.. so, eventually can figure all this out, I hope :1orglaugh

I had it working fine with php and with perl (for those that didn't have php remote include configured in their php) long before AFF did their geoIP ads - I had over 300 people using my ad includes and made me a mint.

With php, it's a simple include("http://foo.com")
with perl/cgi: it's make a client cgi file called "proxy.cgi" with the contents:

Code:

use LWP::Simple;
print "Content-type:text/html\n\n";
getprint ($ENV{'QUERY_STRING'});

then have the clients add this code wherever they want to include your html:

<!--#include virtual="/cgi-bin/proxy.pl?http://yourserver.com/yourpage.html" -->


All times are GMT -7. The time now is 09:04 PM.

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