Jump to content

Archived

This topic is now archived and is closed to further replies.

Adam6

Help please :D

Recommended Posts

Im trying to get a content page include to work.

This works.
[quote]<?

$page = $_GET['page'];
define ("homeurl", "");

if ($page=='') {
include('content/index.php');
} elseif (!file_exists('content/'.$page.'.php')) {
include('content/index.php');
} else {
include(homeurl.'content/'.$page.'.php');
}

?>[/quote]


This dont work.
[quote]<?

$page = $_GET['page'];
define ("homeurl", "http://www.pspbrew.net/opasit/");

if ($page=='') {
include('content/index.php');
} elseif (!file_exists('content/'.$page.'.php')) {
include('content/index.php');
} else {
include(homeurl.'content/'.$page.'.php');
}

?>[/quote]
Why dont the second one work ffs. I want to include the URL. Ive heard if I dont include the URL it will be exploitable?

Help me please. Im a noob  :'(

Im using this to goto the page/include.

[quote]?page=example[/quote]

Share this post


Link to post
Share on other sites
[quote]Ive heard if I dont include the URL it will be exploitable?[/quote]

No more than using this method to display page content ever is.  Just make sure you do some sort of check to make sure that the only input it will accept is what you want it to be.

Remove the http://www.pspbrew.net from the define statement and it should work.

Share this post


Link to post
Share on other sites
Thanks for your reply mate.

Can you edit the code to include the check for me please. As I said im a PHP noob and my PHP skills are very limited atm  :-[

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.