You are here: Re: Session Problem - could it be cos of register_globals? « PHP Programming Language « IT news, forums, messages
Re: Session Problem - could it be cos of register_globals?

Posted by Matthew on 11/19/07 22:07

Rik Wasmus emailed this:
> On Mon, 19 Nov 2007 20:49:23 +0100, Matthew <matthew@spamkiller.com> wrote:
>> Rik Wasmus emailed this:
>
> I thought I posted :P
>
>>> On Mon, 19 Nov 2007 20:38:05 +0100, Rik Wasmus
>>> <luiheidsgoeroe@hotmail.com> wrote:
>>>> On Mon, 19 Nov 2007 20:25:25 +0100, Matthew <matthew@spamkiller.com>
>>>> wrote:
>>>>> As far as I can tell the $_SESSION['uid'] variable should be
>>>>> created automatically when session_start() is called. When I
>>>>> retrieve this variable however it is empty.
>>>>
>>>> Nope. Unless you name it that way.
>>>> <http://nl2.php.net/manual/en/ref.session.php>
>>>>
>>>> The default 'session.name' is PHPSESSID, which you can normally will
>>>> NOT find in $_SESSION, but in one of the $_REQUEST arrays (and thus
>>>> obviously in $_REQUEST). $_COOKIE['PHPSESSID'] _if_ the session
>>>> works with cookies, optionally in the $_POST or $_GET array in case
>>>> of a transparant session id (which is not recommandable).
>>>>
>>>> If you choose another name for a session, this should be done with
>>>> session_name('custom_name_of_session') BEFORE the call to
>>>> session_start():
>>>> <http://nl2.php.net/manual/en/function.session-name.php>
>>
>> Thanks for both replies Rik.
>>
>> > Addendum: if you're just curious what your session id actually is, use
>> > session_id().
>>
>> What about the cookie, how do I retrieve that, I need to add it to a
>> database table?
>
> Trust me, you don't. The value in $_COOKIE['PHPSESSID'] is exactly the
> one given to you by session_id(). (Assuming you have the default
> PHPSESSID session name)

Okay, thanks again. Hopefully I'll get to grips with all this tomorrow.
It's 22.00 in my TZ and I'm ready for a beer (or 2) before bed. Night and
thanks for the help.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация