Re: Defining PHP varibles from URL
| From: | 1LT John W. Holmes | Date: | Mon, 06 May 2002 09:38:29 +0000 |
| Subject: | Re: Defining PHP varibles from URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96222@lists.php.net to get a copy of this message | ||
I would advise against doing that unless you really know what your doing. Doing it that way will
allow anyone to type in any file on your server that PHP has access to and load it, or possibly load
a file off of another server.
That said, if you have a url like page.php?file=foo.inc
Then that value will be present in $_GET["file"] (PHP 4.1+) or
$HTTP_GET_VARS["file"] (PHP <4.1)
include($_GET["file"]);
include($HTTP_GET_VARS["file"]);
---John Holmes...
----- Original Message -----
From: webmaster@tececo.com
To: php-general-uc.1020556536.jjfnbcbjfcmealicppog-webmaster=tececo.com@lists.php.net
Sent: Monday, May 06, 2002 5:28 AM
Subject: [PHP] Defining PHP varibles from URL
I don't mean to be a pain but could someone send me a working example?
I am what you would probably call a 'newbie'
For those who don't know here is my previous message
can't seem to define a varible from the url entered into a browser.
I wish to use the following code or something like it.
<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
Thanks,
JJ Harrison
webmaster@tececo.com
www.tececo.com
------------------------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php