Re: [PHP] Sessions with register_globals = off
Sessions are now being registered, but I have a problem unregistering them. This is the code that I'm using to test it: kill.php session_start(); print("ID = ".$_SESSION['id']); //The value is printed print("PERMISOS = ".$_SESSION['permisos']); //The value is printed unset($_SESSION['id']); unset($_SESSION['permisos']); print("ID = ".$_SESSION['id']); //The value is NOT printed print("PERMISOS = ".$_SESSION['permisos']); //The value is NOT printed ---kill.php- If the page is reloaded, the result is exactly the same. But if I keep reloading the page $_SESSION['id'] and $_SESSION['permisos'] have the same value. Is there any other way to unregister session variables ??? Thank you very much. _ Mauricio Cuenca - Original Message - From: "Daniel Guerrier" <[EMAIL PROTECTED]> To: "Mauricio Cuenca" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, September 06, 2002 2:11 PM Subject: Re: [PHP] Sessions with register_globals = off > Here you go > > http://www.zend.com/manual/function.session-is-registered.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions with register_globals = off
Here you go http://www.zend.com/manual/function.session-is-registered.php --- Mauricio Cuenca <[EMAIL PROTECTED]> wrote: > Hello, > > I'm working with register_globals turned off. I'm > setting this session > cookie: > >if ($nresult) { > if (mysql_numrows($nresult)) { > session_start(); > $_SESSION['auth'] = 'TRUE'; } } > > And then I'm checking if the cookie is set, but it > doesn't work: >if ($_SESSION['auth'] == 'TRUE') { > show_menu(); } > > Is there any error on my code ? What am I doing > wrong ? > I read this on http://www.php.net/release_4_1_0.php: > "Another neat trick is that creating new entries in > the $_SESSION array will > automatically register them as session variables, as > if you called > session_register(). This trick is limited to the > session module only - for > example, setting new entries in $_ENV will *not* > perform an implicit > putenv()." > > That's what I am not using > sessione_register($variable). > > TIA, > > _ > Mauricio Cuenca > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions with register_globals = off
Hello, I'm working with register_globals turned off. I'm setting this session cookie: if ($nresult) { if (mysql_numrows($nresult)) { session_start(); $_SESSION['auth'] = 'TRUE'; } } And then I'm checking if the cookie is set, but it doesn't work: if ($_SESSION['auth'] == 'TRUE') { show_menu(); } Is there any error on my code ? What am I doing wrong ? I read this on http://www.php.net/release_4_1_0.php: "Another neat trick is that creating new entries in the $_SESSION array will automatically register them as session variables, as if you called session_register(). This trick is limited to the session module only - for example, setting new entries in $_ENV will *not* perform an implicit putenv()." That's what I am not using sessione_register($variable). TIA, _ Mauricio Cuenca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions with register_globals = off
> -Original Message- > From: Padraig Kitterick [mailto:[EMAIL PROTECTED]] > Sent: 26 April 2002 20:16 > To: [EMAIL PROTECTED] > Subject: [PHP] Sessions with register_globals = off > > > Am in need of help or I will loose my sanity!!! Im runnin Php > 4.1.2 with > Apache 1.3.22 on Win32 with register_globals set to off. My > script is as > follows: Well, here's you first problem -- sessions are broke in PHP 4.1.2 on Windows. Either roll back to 4.1.1 or (preferably) upgrade to 4.2.0. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions with register_globals = off
On Friday, April 26, 2002, at 03:16 PM, Padraig Kitterick wrote: > This is annoying as everyhwhere I read about sessions, Im told that if > register_globals is off, I shouldnt use session_register(), all I need > to do > is: > > $HTTP_SESSION_VARS["myVar"] = $myVar; This is not what the documentation says. http://www.php.net/manual/en/ref.session.php You should use $_SESSION['myVar'] = $myVar; Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions with register_globals = off
Make sure you are using session_start() on each page and you should be using $_SESSION["var"] = "value";, not $HTTP_SESSION_VARS... ---John Holmes... > -Original Message- > From: Padraig Kitterick [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 26, 2002 12:16 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Sessions with register_globals = off > > Am in need of help or I will loose my sanity!!! Im runnin Php 4.1.2 with > Apache 1.3.22 on Win32 with register_globals set to off. My script is as > follows: > > > session_start(); > > $myVar = "Something"; > > $HTTP_SESSION_VARS["mySessionVar"] = $myVar; > > ?> > > If I check the cookie, its completely empty. Now if I change this to: > > > session_start(); > > $myVar = "Something"; > > session_register("myVar"); > > ?> > > the cookie now contains: > myVar|s:9:"Something"; > > This is annoying as everyhwhere I read about sessions, Im told that if > register_globals is off, I shouldnt use session_register(), all I need to > do > is: > > $HTTP_SESSION_VARS["myVar"] = $myVar; > > or > > $_SESSION["myVar"] = $myVar; > > but neither work :( > > > > Finally, if I want to change the value of $HTTP_SESSION_VARS["myVar"] and > carry that change over to the next page it doesnt work. For example, i > have > registered the session variable $myVar as above and can read it using > $HTTP_SESSION_VARS["myVar"]. If I do: > > > > $HTTP_SESSION_VARS["myVar"] = "Some other text"; > > > > then $HTTP_SESSION_VARS["myVar"] contains that text, but only for this > page! How do I use sessions then with register_globals = off???!!! > > > > > -- > 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
[PHP] Sessions with register_globals = off
Am in need of help or I will loose my sanity!!! Im runnin Php 4.1.2 with Apache 1.3.22 on Win32 with register_globals set to off. My script is as follows: If I check the cookie, its completely empty. Now if I change this to: the cookie now contains: myVar|s:9:"Something"; This is annoying as everyhwhere I read about sessions, Im told that if register_globals is off, I shouldnt use session_register(), all I need to do is: $HTTP_SESSION_VARS["myVar"] = $myVar; or $_SESSION["myVar"] = $myVar; but neither work :( Finally, if I want to change the value of $HTTP_SESSION_VARS["myVar"] and carry that change over to the next page it doesnt work. For example, i have registered the session variable $myVar as above and can read it using $HTTP_SESSION_VARS["myVar"]. If I do: $HTTP_SESSION_VARS["myVar"] = "Some other text"; then $HTTP_SESSION_VARS["myVar"] contains that text, but only for this page! How do I use sessions then with register_globals = off???!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php