RE: [PHP] Defining PHP varibles from URL
| From: | David Freeman | Date: | Sun, 05 May 2002 07:36:55 +0000 |
| Subject: | RE: [PHP] Defining PHP varibles from URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96126@lists.php.net to get a copy of this message | ||
-----Original Message-----
<script language="php">
$file = "";
//the above is defined from the url
include "$file";
</script>
It could be what I was typing in the url bar.
file.php?file=foobar.inc
-----Original Message-----
Hmm, so you define $file in your url as "foobar.inc" and then, in the
page itself you take change $file to be "".
At least, that's how I'd read it. I'd suggest, it's not an overly good
idea to include a file like this as someone else has already mentioned.
In any event, your fix would have to be something like this:
<script language="php">
If (!isset($file) || empty($file))
{
$file = "some file";
}
Include "$file" ;
</script>
That way you're only going to over-write the contents of $file if it's
already either unset or empty.
CYA, Dave