Re: [PHP] newbie question regarding URL parameters

This is a discussion on Re: [PHP] newbie question regarding URL parameters within the PHP General forums, part of the PHP Programming Forums category; You'll probably get 50 answers to this, but here's probably what happened. There's a setting called "...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-06-2007
tg-php@gryffyndevelopment.com
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

You'll probably get 50 answers to this, but here's probably what happened.

There's a setting called "register globals" that will turn your name=me and age=27 into $name = "me" and $age = "27". It used to be turned ON by default. This was generally considered to be bad security, so it now defaults to OFF.

To get these variables, just use the $_GET system variable.

$name = $_GET['name'];
$age = $_GET['age'];

Easy!

Best of luck!

-TG



= = = Original message = = =

Hello,

I have a newbie question regarding URL parameters. The PHP script I
wrote need to read parameters passed in from a URL, so as an example

http://my.domain/myscript.php?name=me&age=27

and my script would use $name to get the value for name and $age to
get the value for age.

Everything was working fine until the sysadmin did a upgrade of the
PHP server, and $name and $age both give me nothing.

I am just wondering if the latest version of PHP has changed the way
to access url parameters. If so, what would be the correct way of
doing it? Please help. Thanks.

- Jim


__________________________________________________ _________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
Reply With Quote
  #2 (permalink)  
Old 01-09-2007
tedd
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

At 9:17 PM -0500 1/5/07, <tg-php@gryffyndevelopment.com> wrote:
>You'll probably get 50 answers to this, but here's probably what happened.
>
>There's a setting called "register globals" that will turn your
>name=me and age=27 into $name = "me" and $age = "27". It used to be
>turned ON by default. This was generally considered to be bad
>security, so it now defaults to OFF.
>
>To get these variables, just use the $_GET system variable.
>
>$name = $_GET['name'];
>$age = $_GET['age'];
>
>Easy!
>
>Best of luck!
>
>-TG


Just to add to -TG advice, you should also clean those inputs. IWO,
make sure the values fall within what you expect. Basic security.

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #3 (permalink)  
Old 01-09-2007
Dave Goodchild
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

Wow, there are some really bitchy, unattractive people here. No wonder some
people bail out of IT. Don't confuse knowledge for wisdom.

On 1/9/07, tedd <tedd@sperling.com> wrote:
>
> At 9:17 PM -0500 1/5/07, <tg-php@gryffyndevelopment.com> wrote:
> >You'll probably get 50 answers to this, but here's probably what

> happened.
> >
> >There's a setting called "register globals" that will turn your
> >name=me and age=27 into $name = "me" and $age = "27". It used to be
> >turned ON by default. This was generally considered to be bad
> >security, so it now defaults to OFF.
> >
> >To get these variables, just use the $_GET system variable.
> >
> >$name = $_GET['name'];
> >$age = $_GET['age'];
> >
> >Easy!
> >
> >Best of luck!
> >
> >-TG

>
> Just to add to -TG advice, you should also clean those inputs. IWO,
> make sure the values fall within what you expect. Basic security.
>
> tedd
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--
http://www.web-buddha.co.uk

Reply With Quote
  #4 (permalink)  
Old 01-09-2007
Dave Goodchild
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

Read the reponses.

Reply With Quote
  #5 (permalink)  
Old 01-09-2007
Robert Cummings
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

On Tue, 2007-01-09 at 18:41 +0000, Roman Neuhauser wrote:
> # buddhamagnet@gmail.com / 2007-01-09 17:36:55 +0000:
> > Wow, there are some really bitchy, unattractive people here. No wonder some
> > people bail out of IT. Don't confuse knowledge for wisdom.

>
> I don't see anything bitchy in the whole email. Don't confuse terseness
> with bitching.


Who asked you. Now shudup and get back to work.

Cheers,
Rob.

Ps. this has been in jest :B
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
Reply With Quote
  #6 (permalink)  
Old 01-09-2007
tedd
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

At 5:36 PM +0000 1/9/07, Dave Goodchild wrote:
>Wow, there are some really bitchy, unattractive people here. No
>wonder some people bail out of IT. Don't confuse knowledge for
>wisdom.


Dave:

I don't understand your comment. What I said below is good coding.
Never trust any input to be what you expect it to be.

An excellent book on this subject is Chirs' book:

http://phpsecurity.org/

tedd

PS: Nice looking new site Chris !

== previous

>
>On 1/9/07, tedd <<mailto:tedd@sperling.com>tedd@sperling.com> wrote:
>
>At 9:17 PM -0500 1/5/07, <
><mailto:tg-php@gryffyndevelopment.com>tg-php@gryffyndevelopment.com>
>wrote:
>>You'll probably get 50 answers to this, but here's probably what happened.
>>
>>There's a setting called "register globals" that will turn your
>>name=me and age=27 into $name = "me" and $age = "27". It used to be
>>turned ON by default. This was generally considered to be bad
>>security, so it now defaults to OFF.
>>
>>To get these variables, just use the $_GET system variable.
>>
>>$name = $_GET['name'];
>>$age = $_GET['age'];
>>
>>Easy!
>>
>>Best of luck!
>>
>>-TG

>
>Just to add to -TG advice, you should also clean those inputs. IWO,
>make sure the values fall within what you expect. Basic security.
>
>tedd
>--
>-------
><http://sperling.com>http://sperling.com
> <http://ancientstones.com>http://ancientstones.com <http://earthstones.com>http://earthstones.com
>
>--
>PHP General Mailing List (<http://www.php.net/>http://www.php.net/)
>To unsubscribe, visit:
><http://www.php.net/unsub.php>http://www.php.net/unsub.php
>
>
>
>
>--
><http://www.web-buddha.co.uk>http://www.web-buddha.co.uk



--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #7 (permalink)  
Old 01-09-2007
Roman Neuhauser
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

# buddhamagnet@gmail.com / 2007-01-09 17:36:55 +0000:
> Wow, there are some really bitchy, unattractive people here. No wonder some
> people bail out of IT. Don't confuse knowledge for wisdom.


I don't see anything bitchy in the whole email. Don't confuse terseness
with bitching.

Oh, and also don't top-post, thanks.

> On 1/9/07, tedd <tedd@sperling.com> wrote:
> >
> >At 9:17 PM -0500 1/5/07, <tg-php@gryffyndevelopment.com> wrote:
> >>You'll probably get 50 answers to this, but here's probably what

> >happened.
> >>
> >>There's a setting called "register globals" that will turn your
> >>name=me and age=27 into $name = "me" and $age = "27". It used to be
> >>turned ON by default. This was generally considered to be bad
> >>security, so it now defaults to OFF.
> >>
> >>To get these variables, just use the $_GET system variable.
> >>
> >>$name = $_GET['name'];
> >>$age = $_GET['age'];
> >>
> >>Easy!
> >>
> >>Best of luck!
> >>
> >>-TG

> >
> >Just to add to -TG advice, you should also clean those inputs. IWO,
> >make sure the values fall within what you expect. Basic security.


--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
Reply With Quote
  #8 (permalink)  
Old 01-11-2007
Jochem Maas
 
Posts: n/a
Default Re: [PHP] newbie question regarding URL parameters

Dave Goodchild wrote:
> Wow, there are some really bitchy, unattractive people here. No wonder some


not to mention some very judgemental people as well. :-) it's pretty funny
that someone who purports to aspire to buddhahood is so stuck in complaining
about other people's bitchiness and unattractiveness. thanks for the smile, Dave.

[buddha has thicker skin, and his feet are dirty.]

I wouldn't bother with a hypocracy argument in reply - I already know about my own
hypocracy. :-)

> people bail out of IT.


most people bail out of IT because of the peanuts being paid, the
completely ungrateful management they work for, the crazy hours their expected
to work and the severe lack of goodlooking women walking around in the
average data bunker.

selling crack, making porn & writing a few rap lyrics is so much easier -
just ask SnoopDog.

> Don't confuse knowledge for wisdom.


whoahoo, a racecar heh?

>
> On 1/9/07, tedd <tedd@sperling.com> wrote:
>>
>> At 9:17 PM -0500 1/5/07, <tg-php@gryffyndevelopment.com> wrote:
>> >You'll probably get 50 answers to this, but here's probably what

>> happened.
>> >
>> >There's a setting called "register globals" that will turn your
>> >name=me and age=27 into $name = "me" and $age = "27". It used to be
>> >turned ON by default. This was generally considered to be bad
>> >security, so it now defaults to OFF.
>> >
>> >To get these variables, just use the $_GET system variable.
>> >
>> >$name = $_GET['name'];
>> >$age = $_GET['age'];
>> >
>> >Easy!
>> >
>> >Best of luck!
>> >
>> >-TG

>>
>> Just to add to -TG advice, you should also clean those inputs. IWO,
>> make sure the values fall within what you expect. Basic security.
>>
>> tedd
>> --
>> -------
>> http://sperling.com http://ancientstones.com http://earthstones.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

>
>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:51 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0