RE: [PHP] Problem with sessions.
| From: | Philip Olson | Date: | Fri, 20 Dec 2002 02:28:51 +0000 |
| Subject: | RE: [PHP] Problem with sessions. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128933@lists.php.net to get a copy of this message | ||
For the record, variables are case sensitive so it's
$_SESSION not $_session.
And if you're going to use $_SESSION (which you should),
do not use session_register().
Regards,
Philip
On Thu, 19 Dec 2002, Mike Hillyer wrote:
> I have recieved a private response, it appears my system had
> register_globals off and the other server would have had it turned on. The
> proper usage was actually $_session["name"] and I shall be using that.
>
> This was my first use of the PHP mailing list and I am very impressed and
> pleased with all the quick and helpful responses. Thank you all.
>
> Mike Hillyer
>
> -----Original Message-----
> From: Quentin Bennett [mailto:Quentin.Bennett@infinity.co.nz]
> Sent: Thursday, December 19, 2002 5:24 PM
> To: PHP GENERAL LIST
> Subject: RE: [PHP] Problem with sessions.
>
>
> Hi,
>
> Is your 'other server' identical (Web Server, PHP Version, register_globals
> setting)?
>
> Quentin
>
> -----Original Message-----
> From: Mike Hillyer [mailto:m.hillyer@telusplanet.net]
> Sent: Friday, 20 December 2002 12:43 p.m.
> To: PHP GENERAL LIST
> Subject: [PHP] Problem with sessions.
>
>
> Hello All;
>
> Please forgive me if I am repeating an often asked question, but I am having
> a problem with sessions. I simply cannot get them to work.
>
> The sample code I provide works on another server perfectly, this is the
> first page:
>
> <?PHP
>
> session_start();
> session_register("name","pass");
> $name = "hilde";
> $pass = "mypassword";
> echo "<h1>Session variables set!</h1>";
> echo "<a href=\"page2.php\">go to next page</a>";
>
> ?>
>
> When called, the following file arrives in /tmp:
>
> sess_f9c5e87b35ae66eac64a9a346321b269
>
> name|s:5:"hilde";pass|s:10:"mypassword";
>
>
>
> So obviously the session file is being created.
> However, when I go to page2.php?PHPSESSID=f9c5e87b35ae66eac64a9a346321b269
> Which has this code:
>
> <?PHP
> session_start();
> echo "<h1>The password of $name is $pass </h1>";
>
> ?>
>
> I get "The Password of is "
>
> As a response. Both pages work perfectly on another server, so I am having
> trouble finding the problem, especially since the session file is actually
> created in /tmp
>
> My PHP.ini file is standard to a RedHat RPM install, but I will include it
> as an attachment.
>
> Any help would be greatly appreciated!
>
> Mike Hillyer
>
> The information contained in this email is privileged and confidential and
> intended for the addressee only. If you are not the intended recipient, you
> are asked to respect that confidentiality and not disclose, copy or make use
> of its contents. If received in error you are asked to destroy this email
> and contact the sender immediately. Your assistance is appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>