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
php question
Moderator: General Moderators
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
}
?>-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
Re: php question
Hi this looks like a nice idea on paper, but be VERY careful you don't allow people to hack your site this way!Illusionist wrote:load page1 into the IFrame
Check the first example here.
Dr Evil
-
Grumpyoldman
- Forum Newbie
- Posts: 1
- Joined: Tue Jan 27, 2004 4:18 am
php question
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...
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...