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


Groups > comp.lang.php > #5760

Re: Session variables..

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Session variables..
Date 2012-04-27 06:30 -0400
Organization A noiseless patient Spider
Message-ID <jndsgn$5lv$1@dont-email.me> (permalink)
References <22074986.120.1335432844876.JavaMail.geo-discussion-forums@pbgg7> <9vsjfdFj9mU1@mid.uni-berlin.de> <30831126.627.1335508430505.JavaMail.geo-discussion-forums@pbcoq1>

Show all headers | View raw


On 4/27/2012 2:33 AM, karan kumar wrote:
> Thanks.. Silly me , The unbalanced quote was culprit..
>
> But another error crept out while the former one was solved...
>
> PLZ take a look and Provide for a solutionn
>
>
> code is....-->
>
>
> <?php
> session_start();
> $_SESSION['psid']=111;
> echo $_SESSION['psid'];
> $psid=999;
> echo "  ".$_SESSION['psid'];
> ?>
>
> the output is-->1111 1111
>
> but if you reload the page 2nd time then output changes to--->  "1111 9999"
>
> and if you write session_destroy() at the end then the output remains unchanged..
> how come local variable psid is overwritten over $_SESSION['psid'].??
>

In this example, $psid is not being overwritten by $_SESSION['psid']. 
That's why you get the 1111 twice.

According to your code, it should not happen the second time either.  Is 
there any chance you've got register_globals on in your php.ini file? 
If so, you should turn it off immediately.  It's a huge security problem 
and a "feature" which will be removed in PHP 6.

But it still doesn't explain why you get two different outputs.

BTW, the output is incorrect (according to your code, it should be '111 
111').  Please be careful when copying your code as minor errors can 
cause large differences in the results.

> I have manually configured apache and using PHP as an apache module(not using any package like xampp,wamp etc)...


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

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


Thread

Session variables.. xs2karan3190@gmail.com - 2012-04-26 02:34 -0700
  Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-26 11:39 +0200
    Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-04-26 23:33 -0700
      Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-27 10:59 +0200
      Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-27 06:30 -0400
        Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-05-02 21:19 -0700
          Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-03 08:11 -0400
            Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-05-03 23:19 -0700
              Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-04 07:36 -0400
    Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-04-26 23:36 -0700
      Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-27 10:52 +0200
  Re: Session variables.. "Olaf S." <thesys@gmx.de> - 2012-04-26 14:10 +0200
    Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-26 15:12 +0200
      Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-26 20:35 -0400
  Re: Session variables.. Scott Johnson <noonehome@chalupasworld.com> - 2012-04-26 05:36 -0700
  Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-26 20:37 -0400

csiph-web