A simple example might be (unoptimised for clarity):
http://www.myserver.com/someurl/page.php?file=home
v4.1.x
$file = $_GET("file");
// Remove case sensitivity
$file = strtolower($file);
// To stop people including just ANY old file, we are going to use a
switch
// to validate the
-Original Message-
I don't mean to be a pain but could someone send me a working example?
-Original Message-
This was replied to already by me and others. Didn't you read the
replies?
In any event, here's what I wrote last time...
-Original Message-
$file = "";
//the
On Monday 06 May 2002 17:28, [EMAIL PROTECTED] wrote:
> 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
Didn't you read the numerous replies to your first posting?
--
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
The way you're doing it now, you're first ERASING whatever value passed from
the URL, with
$file="";
and then trying to use it...
If this ' $file="" ' is some declaration attempt, just drop it, you don't
need to declare variables in PHP. Just check if $file has a value and then
use it.
For ex
On Sun, 5 May 2002, Teemu Pentinsaari wrote:
>>> It could be what I was typing in the url bar.
>>>
>>> file.php?file=foobar.inc
>>
>> 1) Try include $_GET['file'];
>>
>> 2) Let me know where your server is so I can go to
>>
>>http://your.server/file.php?file=/etc/passwd
>
> You might want to
>
> file.php?file=inc.foobar.php
> -
> include("include/$file");
>
That doesn't fix anything...
file.php?file=../../../etc/passwd
Just a matter of a few tries to see how many directories you have to go
up...
---John Holmes...
--
PHP General Mailing List (http:
> > It could be what I was typing in the url bar.
> >
> > file.php?file=foobar.inc
>
> 1) Try include $_GET['file'];
>
> 2) Let me know where your server is so I can go to
>
>http://your.server/file.php?file=/etc/passwd
>
> miguel
You might want to use .php file extension and /include/ direct
-Original Message-
$file = "";
//the above is defined from the url
include "$file";
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
On Sun, 5 May 2002 [EMAIL PROTECTED] wrote:
> I 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.
>
>
> $file = "";
> //the above is defined from the url
> include "$file";
>
>
> It could be what I was typing in the
10 matches
Mail list logo