Re[2]: [PHP] Sessions?
Hello brian, Thursday, July 26, 2007, 2:47:55 PM, you wrote: > The way that i generally handle this is to use a class. I instantiate an > object when the page loads, whether the form has been submitted or not. Tnx for the response Brian. Being a newbie i'll read your post carefully, trying to understand it all and plunge into it :-) -- Best regards, Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Sessions simply do not work?
Hi, Wednesday, May 26, 2004, 2:28:58 AM, you wrote: MRW> On Tue, May 25, 2004 at 07:37:47AM +0100, Peter Risdon wrote: >> Michael R. Wayne wrote: >> >> >In my continuing efforts to actually get sessions to work, I upgraded >> >to PHP 4.3.6 and apache 1.3.31. This did not make the slighest >> >difference. >> > >> >So, does ANYone have ideas of how to debug this? Or is PHP simply >> >broken and no longer able to maintain sessions? >> >> I've just been debugging some session problems. Successfully, but there >> is something rather brittle in there somewhere MRW> It seems that people have forgotten last week's postings. To recap: MRW> Session support worked fine in 4.1.2. It's broken in 4.3.4 and 4.3.6. MRW> The relevant session variables are: MRW>Session Support enabled (as per phpinfo) MRW>session.auto_start On or Off (makes no difference) MRW>session.use_cookies Off<- not using cookies MRW>session.namePHPSESSID MRW>session.use_trans_sidOff(trans_sid worked with forms in 4.1.2) MRW>session.gc_maxlifetime 1440 MRW> Other things people have asked about: MRW> MRW> url_rewriter.tags a=href,area=href,frame=src,input=src,form=fakeentry if your not using cookies you have to pass the sessionid in your form as a hidden variable somewhere. Or maybe I missed it :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] sessions
* Thus wrote Maarten Weyn ([EMAIL PROTECTED]): > it works back after a reboot What works how after what is booted when? Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] sessions
it works back after a reboot but does anybody know how it could have happened? "Richard Davey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Jeroen, > > Sunday, May 23, 2004, 4:00:46 PM, you wrote: > > >> Should username have quote around it? Wouldn't it try to make it a constant otherwise? > >> echo $_SESSION['username'] > > JS> Unfortunately, imho, php doesn't seem to care that much in such cases ;-) > JS> $_SESSION[username] will have the same result as $_SESSION['username'] > > It cares enough to raise a script Warning ;) > > Best regards, > > Richard Davey > -- > http://www.launchcode.co.uk - PHP Development Services > "I am not young enough to know everything." - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] sessions
On Sun, 23 May 2004, Richard Davey wrote: > > It cares enough to raise a script Warning ;) > That's true, but it should be giving an error instead of a warning imho ;-) -- Jeroen Anybody who thinks a little 9,000-line program [Java] that's distributed free and can be cloned by anyone is going to affect anything we do at Microsoft has his head screwed on wrong. -- Bill Gates -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] sessions
Hello Jeroen, Sunday, May 23, 2004, 4:00:46 PM, you wrote: >> Should username have quote around it? Wouldn't it try to make it a constant >> otherwise? >> echo $_SESSION['username'] JS> Unfortunately, imho, php doesn't seem to care that much in such cases ;-) JS> $_SESSION[username] will have the same result as $_SESSION['username'] It cares enough to raise a script Warning ;) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I am not young enough to know everything." - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] sessions timeout
but since the cookie stores the session id, I thought I could keep that ID and bring it back. could you show me some code, or point me to some example? Thanks On Tue, 2004-03-09 at 23:48, Richard Davey wrote: > Hello André, > > Tuesday, March 9, 2004, 11:41:04 PM, you wrote: > > AVL> But my question is, since I don't deal with cookies directly (PHP does > AVL> that for me), 'cause I only have to deal with sessions, how can I change > AVL> the cookies produced by PHP? > > AVL> atm I only session_start() and use the $_SESSION[''], so I don't really > AVL> know which cookie to change, or how to do it. > > In that case the reason the session expires when the browser closes is > because that is what sessions are designed to do. In order to "bring > them back" you need to issue a cookie of your own that keeps track and > re-builds the session when they return. > > -- > Best regards, > Richard Davey > http://www.phpcommunity.org/wiki/296.html -- I/O, I/O, It's off to disk I go, A bit or byte to read or write, I/O, I/O, I/O... signature.asc Description: This is a digitally signed message part
Re[2]: [PHP] sessions timeout
Hello André, Tuesday, March 9, 2004, 11:41:04 PM, you wrote: AVL> But my question is, since I don't deal with cookies directly (PHP does AVL> that for me), 'cause I only have to deal with sessions, how can I change AVL> the cookies produced by PHP? AVL> atm I only session_start() and use the $_SESSION[''], so I don't really AVL> know which cookie to change, or how to do it. In that case the reason the session expires when the browser closes is because that is what sessions are designed to do. In order to "bring them back" you need to issue a cookie of your own that keeps track and re-builds the session when they return. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Sessions 2!!!
Hi, Tuesday, October 8, 2002, 12:00:59 PM, you wrote: TR> After the successful first login you are not saving the $_POST variables TR> into the $_SESSION equivalents TR> -- TR> regards, TR> Tom Ok after looking a little harder I found you were setting it :) Your prblem is in the lines if(isset($ssname)) { $_SESSION['ssun'] =$_POST['ssname']; } should be if(isset($_POST['ssname'])) { $_SESSION['ssun'] =$_POST['ssname']; } As you have set the &_SESSION vars you only need to do the one test on the database to check them ... drop the query with the $_POST vars -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] sessions help
On Thu, 13 Jun 2002, Kevin Stone wrote: > Your problem is here.. > > return ($_SESSION['node'] = $node_id); > > I do not believe that you can both set and return a varaible on the same > line. FYI, the variable which you're returning in this function is global.. > so there's no reason to return it anyway. Just fill the index and you're > all set. There's no particular reason that in itself shouldn't work - the return value of an assignment is the result of the assignment. Try: $i = 1; echo $i = $i + 3; miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] sessions help
Your problem is here.. > return ($_SESSION['node'] = $node_id); I do not believe that you can both set and return a varaible on the same line. FYI, the variable which you're returning in this function is global.. so there's no reason to return it anyway. Just fill the index and you're all set. -Kevin - Original Message - From: "Leston Drake" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 13, 2002 3:32 PM Subject: Re[2]: [PHP] sessions help > Thanks to Julie and Stuart for helping me. > > With your direction, I got rid of the warning about the headers by putting > the session_start() at the beginning of the file. > > Now I get a different sort of error when I try to retrive the session variable: > --- > Warning: Undefined index: node in c:\program files\apache > group\apache\htdocs\wan\getglobal.php on line 17 > --- > > Any ideas why? > > (Here's the exact code I've got) > [sessions.php] > > > > A test > > > > function sessionSetNode ($node_id) { > return ($_SESSION['node'] = $node_id); > } > > sessionSetNode("10.2"); > ?> > > > > > [getglobal.php] > > > > A test > > > > if (!empty($_SESSION)) { >extract($_SESSION); >} else if (!empty($HTTP_SESSION_VARS)) { >extract($HTTP_SESSION_VARS); >} > >function sessionGetNode () { > return $_SESSION['node']; >} > >$n = sessionGetNode(); >echo ("Node is $n."); > ?> > > > > > > TIA, > Leston > > > -- > 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
Re[2]: [PHP] sessions help
At 03:32 PM 6/13/2002, you wrote: >Thanks to Julie and Stuart for helping me. > >With your direction, I got rid of the warning about the headers by putting >the session_start() at the beginning of the file. > >Now I get a different sort of error when I try to retrive the session >variable: >--- >Warning: Undefined index: node in c:\program files\apache >group\apache\htdocs\wan\getglobal.php on line 17 >--- > >Any ideas why? > >(Here's the exact code I've got) This is the code, w/o formatting, and w/o the html tags. Sorry about the formatting in the email >[sessions.php] > >$node_id); } sessionSetNode("10.2"); ?> >[getglobal.php] > >(!empty($HTTP_SESSION_VARS)) { extract($HTTP_SESSION_VARS); } function >sessionGetNode () { return $_SESSION['node']; } $n = sessionGetNode(); >echo ("Node is $n."); ?> > >TIA, >Leston > > >-- >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
Re[2]: [PHP] sessions help
Thanks to Julie and Stuart for helping me. With your direction, I got rid of the warning about the headers by putting the session_start() at the beginning of the file. Now I get a different sort of error when I try to retrive the session variable: --- Warning: Undefined index: node in c:\program files\apache group\apache\htdocs\wan\getglobal.php on line 17 --- Any ideas why? (Here's the exact code I've got) [sessions.php] A test [getglobal.php] A test TIA, Leston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] sessions help
It's the 1st line after LD> I just tried adding session_start() to the beginning of both files. >When I >LD> load Doc 1, I get this warning twice(!): > >LD> Warning: Cannot send session cache limiter - headers already sent (output >LD> started at c:\program files\apache >group\apache\htdocs\wan\sessions.php:7) >LD> in c:\program files\apache group\apache\htdocs\wan\sessions.php on line 9 > >LD> Same warning for Doc 2. > > >That just means you put it in the wrong place. It has to go before >any (and "any" means ANY) output. > > >- Julie > >--> Julie Meloni >--> [EMAIL PROTECTED] >--> www.thickbook.com > >Find "Sams Teach Yourself MySQL in 24 Hours" at >http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] sessions help
On Thursday, June 13, 2002 at 10:04:05 PM, you wrote: > I just tried adding session_start() to the beginning of both files. When I > load Doc 1, I get this warning twice(!): > Warning: Cannot send session cache limiter - headers already sent (output > started at c:\program files\apache group\apache\htdocs\wan\sessions.php:7) > in c:\program files\apache group\apache\htdocs\wan\sessions.php on line 9 > Same warning for Doc 2. In that case the call to session_start() is not at the beginning of the files. By that I mean the first line in both files should be... Before any HTML or other PHP code. This is because it sets a cookie which needs to be able to send an HTTP header which can only be done before any output is generated (unless output buffering is enabled). According to the error, the call to session_start() is on line 9 but output was generated on line 7. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] sessions help
LD> I just tried adding session_start() to the beginning of both files. When I LD> load Doc 1, I get this warning twice(!): LD> Warning: Cannot send session cache limiter - headers already sent (output LD> started at c:\program files\apache group\apache\htdocs\wan\sessions.php:7) LD> in c:\program files\apache group\apache\htdocs\wan\sessions.php on line 9 LD> Same warning for Doc 2. That just means you put it in the wrong place. It has to go before any (and "any" means ANY) output. - Julie --> Julie Meloni --> [EMAIL PROTECTED] --> www.thickbook.com Find "Sams Teach Yourself MySQL in 24 Hours" at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php