Posts: 197
Threads: 14
Joined: May 2004
This used to work with PHP 5 - but now it doesn't work in PHP 4.
I have a varible in the address bar - $p, which is the name of a page I want to include.
[syntax="php"]include ($p.".php");[/syntax]
any hints?
Posts: 1,813
Threads: 284
Joined: Mar 2003
[syntax="php"]include($_GET['p'].".php");[/syntax]
earn.
Posts: 197
Threads: 14
Joined: May 2004
Posts: 1,813
Threads: 284
Joined: Mar 2003
thats always the preferred method. i didnt know they made it the only method in php5. but itb maes sense.
earn.
Posts: 3,343
Threads: 83
Joined: Mar 2003
It's a potential security hole for those who don't know what they're doing (and besides, registering variables is just annoying for an experience programmer).
Eno: That's a *huge* security hole you got there: What happens if I pass a path to a script I shouldn't access in variable $p? eg:
http://yoursite.com/?p=/home/eno_on/www/...ash_db.php
Make very sure you strip out all / characters from a url, and make double sure any script that shouldn't be run by the public gets authentication first.
Posts: 197
Threads: 14
Joined: May 2004
Will stripslashes() work?