You are here: Re: Undefined variable passing vars via URL locally « All PHP « IT news, forums, messages
Re: Undefined variable passing vars via URL locally

Posted by Bob Bruyn on 07/18/07 10:10

Brilliant. I had actually turner 'register globals' on but that didn't seem
to help.
But your solution
<?php echo $_GET['folder']; ?>
worked perfect.

Thanks!
--


*******************

Bob Bruyn
Torus Design
Argonautenweg 45
3054 RP Rotterdam
010-4184349
http://www.torusdesign.nl
"Harrie Verveer"
<harrie-remove_this_and_the_-_between_i_and_b@i-buildings.nl> wrote in
message news:a-2dnW-q5r4xeADbRVnyiAA@zeelandnet.nl...
> Hi Bob,
>
> this means that the 'register globals' setting is 'off', which is a good
> thing. Using variables the way you do in the example (possible when
> register globals is 'on') can cause serious security issues (because you
> can set any PHP variable through the get/post-vars - which might change
> the behaviour of your script).
>
> The proper (and far more secure) way is to use the $_GET superglobal or
> $_REQUEST superglobal:
>
> <?php echo $_GET['folder']; ?>
>
> or:
>
> <?php
> $folder = $_GET['folder'];
> $navColor = $_GET['navColor'];
>
> echo $folder;
> echo $navColor;
> ?>
>
> or something like that :)
>
> More info:
> http://www.php.net/register_globals
>
> Kind regards,
>
> Harrie Verveer
> ---
> http://www.ibuildings.nl/blog/authors/Harrie-Verveer
>
>
> Bob Bruyn wrote:
>> I've recently installed Apache 2 and php 5.2 on my WIndows XP
>> machine. Everything is up and running.
>>
>> I'm passing some vars via the URL. It works fine online:
>> http://www.torusdesign.nl/spry/test.php?folder=schilderijen/vrij_werk&navColor=SchilderijenNAV
>>
>> This is the code:
>> <?php echo $folder; ?>
>> <?php echo $navColor; ?>
>>
>> The problem is that when I test it locally I get an error that the
>> variable in undefined.
>> Notice: Undefined variable: folder in F:\WEBSERVER\Apache2\htdocs\sonja
>> \test.php on line 14
>> Notice: Undefined variable: folder in F:\WEBSERVER\Apache2\htdocs\sonja
>> \test.php on line 15
>> Notice: Undefined variable: navColor in F:\WEBSERVER\Apache2\htdocs
>> \sonja\test.php on line 32
>>
>> Can someone please help me out. Is there something wrong with my local
>> php configuration?
>>
>> PS. You'll notice the Hello World at the top. That does work locally.
>> (if that's any help)
>>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация