Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #15616

Re: PHP Global Variable Usage - Possible?

From Matthew Carter <m@ahungry.com>
Newsgroups comp.lang.php
Subject Re: PHP Global Variable Usage - Possible?
Date 2015-07-27 20:59 -0400
Organization Ahungry (http://ahungry.com)
Message-ID <87pp3d5c7c.fsf@ahungry.com> (permalink)
References <MPG.301f35426b8e02f09896ae@news.eternal-september.org> <87k2tmcr65.fsf@ahungry.com> <mp6d61$j50$1@dont-email.me>

Show all headers | View raw


Denis McMahon <denismfmcmahon@gmail.com> writes:

> On Sun, 26 Jul 2015 21:42:10 -0400, Matthew Carter wrote:
>
>> MikeCopeland <mrc2323@cox.net> writes:
>> 
>>>    Almost new to PHP, and I'm wondering if PHP will do something I want
>>> to do.  Scenario:
>>>   1. 3 Web pages: index.php; text01.php; and people.php 2. In index.php
>>>   I want to establish a default value in a global
>>> variable ....
>
>> Variables only persist for the duration of script/program execution.
>
>> You may want to look into using cookies 
>
> Bad suggestion, the cookie gets passed to the user, they can change it. 
> Server data persisted in cookies can provide attack vectors.
>
>> or sessions 
>
> Good suggestion, the only way the users can manipulate this is if they 
> manage to hit on a valid session cookie other than their own when 
> manipulating the cookie - sensible session cookie generation makes this 
> highly unlikely.
>
>> (or you could have some persistence via the query string).
>
> Very bad suggestion, query string is even easier for attackers to 
> manipulate than cookies.

All true if the validity of the data needs to remain in-tact.  I just
skimmed his post and didn't really grok if he needed that, or just some
persistent state to his site.

If it's a persistent state that should be shared among users, the query
string is actually very useful, as friends can then send the link back
and forth.

-- 
Matthew Carter (m@ahungry.com)
http://ahungry.com

Back to comp.lang.php | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

PHP Global Variable Usage - Possible? MikeCopeland <mrc2323@cox.net> - 2015-07-26 18:20 -0700
  Re: PHP Global Variable Usage - Possible? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-26 21:41 -0400
    Re: PHP Global Variable Usage - Possible? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-26 21:51 -0400
  Re: PHP Global Variable Usage - Possible? Matthew Carter <m@ahungry.com> - 2015-07-26 21:42 -0400
    Re: PHP Global Variable Usage - Possible? Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-27 23:00 +0000
      Re: PHP Global Variable Usage - Possible? Matthew Carter <m@ahungry.com> - 2015-07-27 20:59 -0400

csiph-web