Page 1 of 1

php question

Posted: Tue Jan 20, 2004 7:38 pm
by Illusionist
I'm wanting to write 1 main php page, and then load seperate pages into an IFrame on that one main php page... but what i wanna do is like index.php?page=page1 and it load page1 into the IFrame, but i also want that if it is jsut index.php to load a default page intot he IFrame, how can i check if the ?page is there or not?

Sorry if this si a bit confusing... i'm a bit confused to at the moment on waht i'm really trying to do! lol

Thanks

Posted: Tue Jan 20, 2004 8:10 pm
by DuFF
to check if the ?page is there:

Code: Select all

<?php
if(isset($_GET['page']))
{
//it's set
}
else
{
//it's not set, load default page
}
?>

Posted: Tue Jan 20, 2004 9:00 pm
by Illusionist
Hey, thanks thats perfect!

Re: php question

Posted: Wed Jan 21, 2004 3:04 am
by Dr Evil
Illusionist wrote:load page1 into the IFrame
Hi this looks like a nice idea on paper, but be VERY careful you don't allow people to hack your site this way!

Check the first example here.

Dr Evil

php question

Posted: Tue Jan 27, 2004 4:18 am
by Grumpyoldman
Sorry if this is just an annoying question. I am new to this and currently feeling somewhat confused.

If I use an include where links read name.php?file=name.html is it enough to add something like

$allowed_files = array
('one.html', 'two.html', 'three.html');

if( in_array($file, $allowed_files) )
{
include($file);
}
else
{
exit;
}

to the include to ensure security or am I missing something else? The idea is similar to the idea that kicked off this thread - I know that there are security issues but am unsure EXACTLY what I need to do to deal with them...