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


Groups > comp.lang.php > #15615

Re: PHP Global Variable Usage - Possible?

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: PHP Global Variable Usage - Possible?
Date 2015-07-27 23:00 +0000
Organization A noiseless patient Spider
Message-ID <mp6d61$j50$1@dont-email.me> (permalink)
References <MPG.301f35426b8e02f09896ae@news.eternal-september.org> <87k2tmcr65.fsf@ahungry.com>

Show all headers | View raw


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.

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.php | Previous | NextPrevious in thread | Next 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