FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Session variables..
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Session variables.. [message #177923 is a reply to message #177917] Fri, 27 April 2012 10:30 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
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(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: const var, self:: or static::
Next Topic: Removing specific array items
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 23:00:21 GMT 2024

Total time taken to generate the page: 0.04218 seconds