Re: [PHP] $_SESSION variables

2009-10-24 Thread Ashley Sheridan
On Sat, 2009-10-24 at 07:52 -0400, Ron Piggott wrote:

 Instead of doing:
 
 $_SESSION['order'][$reference]['quantity'] = 0;
 
 Is there a way to get remove that part of the array altogether?
 
 Ron
 
 


I don't understand your question..

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] $_SESSION variables

2009-10-24 Thread Ron Piggott

I am programming a shopping cart.  

So far I have used 

$_SESSION['order'][$reference]['quantity'] = 0;

if the customer changed their mind about buying an item.  Is there a way
to remove the session variable altogether?

Ron

-Original Message-
From: Ashley Sheridan a...@ashleysheridan.co.uk
Reply-to: a...@ashleysheridan.co.uk
To: ron@actsministries.org
Cc: PHP General php-general@lists.php.net
Subject: Re: [PHP] $_SESSION variables
Date: Sat, 24 Oct 2009 12:52:17 +0100

On Sat, 2009-10-24 at 07:52 -0400, Ron Piggott wrote: 

 Instead of doing:
 
 $_SESSION['order'][$reference]['quantity'] = 0;
 
 Is there a way to get remove that part of the array altogether?
 
 Ron
 
 


I don't understand your question..

Thanks,
Ash
http://www.ashleysheridan.co.uk





Re: [PHP] $_SESSION variables

2009-10-24 Thread Phpster
Unset($_SESSION['order'][$reference]['quantity']); will clear the  
entire session object



Bastien

Sent from my iPod

On Oct 24, 2009, at 8:01 AM, Ron Piggott ron@actsministries.org  
wrote:




I am programming a shopping cart.

So far I have used

$_SESSION['order'][$reference]['quantity'] = 0;

if the customer changed their mind about buying an item.  Is there a  
way

to remove the session variable altogether?

Ron

-Original Message-
From: Ashley Sheridan a...@ashleysheridan.co.uk
Reply-to: a...@ashleysheridan.co.uk
To: ron@actsministries.org
Cc: PHP General php-general@lists.php.net
Subject: Re: [PHP] $_SESSION variables
Date: Sat, 24 Oct 2009 12:52:17 +0100

On Sat, 2009-10-24 at 07:52 -0400, Ron Piggott wrote:


Instead of doing:

$_SESSION['order'][$reference]['quantity'] = 0;

Is there a way to get remove that part of the array altogether?

Ron





I don't understand your question..

Thanks,
Ash
http://www.ashleysheridan.co.uk





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variables

2009-10-24 Thread Lester Caine

Ron Piggott wrote:

Instead of doing:

$_SESSION['order'][$reference]['quantity'] = 0;

Is there a way to get remove that part of the array altogether?


unset?
unset($_SESSION['order'][$reference]['quantity']);

Can't seem to reach php.net to confirm, but I use it myself ;)

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Ford, Mike
On 28 April 2009 15:48, Gary advised:

 I am trying to set a cookie and a session, but seem to be running into
a
 wall.
 
 I have tried different variations, and keep getting the same error
message
 
 If I have this
 
 ?php
 
 session_start();
 
 I get this:
 Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 Warning: session_start() [function.session-start]: Cannot send session
 cache limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 If I have this:
 session_start();
 
 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 I get this
 
 
 Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 Warning: session_start() [function.session-start]: Cannot send session
 cache limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 Warning: Cannot modify header information - headers already sent by
 (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
 
 Warning: Cannot modify header information - headers already sent by
 (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
 
 If I delete and start over, I stll get the headers already sent... I
 have tried numerous other variations, but all with the same error.
 
 What am I missing here?

Whatever it is on line 2 of assessresult.inc.php that is causing output
to be started!

More seriously, there is something on line 2 of that file that is
causing something to be sent to the browser, which in turn causes the
http headers to be sent. Once those headers have been sent, nothing else
that wants to send headers, which includes starting the session and
setting cookies, can be done.

Either eliminate whatever it is on line 2 that is sending output, or
move the session_start() and/or setcookie() calls above it. (This early
in the file, prime candidate is actually a stray blank line outside your
?php tag, but that's only a guess based on past experience of many
people in this list...!!)

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Ashley Sheridan
On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
 I am trying to set a cookie and a session, but seem to be running into a 
 wall.
 
 I have tried different variations, and keep getting the same error message
 
 If I have this
 
 ?php
 
 session_start();
 
 I get this:
 Warning: session_start() [function.session-start]: Cannot send session 
 cookie - headers already sent by (output started at 
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in 
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 Warning: session_start() [function.session-start]: Cannot send session cache 
 limiter - headers already sent (output started at 
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in 
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 If I have this:
 session_start();
 
 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 I get this
 
 
 Warning: session_start() [function.session-start]: Cannot send session 
 cookie - headers already sent by (output started at 
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in 
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 Warning: session_start() [function.session-start]: Cannot send session cache 
 limiter - headers already sent (output started at 
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in 
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
 Warning: Cannot modify header information - headers already sent by (output 
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in 
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
 
 Warning: Cannot modify header information - headers already sent by (output 
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in 
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
 
 If I delete and start over, I stll get the headers already sent... I have 
 tried numerous other variations, but all with the same error.
 
 What am I missing here?
 
 Thanks
 
 Gary 
 
 
 
I would have thought it was obvious, the file assessresult.inc.php is
being called before your session_start(). Have you put your code before
every include?


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Igor Escobar
http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/


Regards,
Igor Escobar
Systems Analyst  Interface Designer

--

Personal Blog
~ blog.igorescobar.com
Online Portifolio
~ www.igorescobar.com
Twitter
~ @igorescobar





On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
  I am trying to set a cookie and a session, but seem to be running into a
  wall.
 
  I have tried different variations, and keep getting the same error
 message
 
  If I have this
 
  ?php
 
  session_start();
 
  I get this:
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session
 cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  If I have this:
  session_start();
 
  setcookie('sale_cookie','$sale_value', time()-3600);
  setcookie('assess_cookie','$assess_value', time()-3600);
  I get this
 
 
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session
 cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: Cannot modify header information - headers already sent by
 (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
 
  Warning: Cannot modify header information - headers already sent by
 (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
 
  If I delete and start over, I stll get the headers already sent... I
 have
  tried numerous other variations, but all with the same error.
 
  What am I missing here?
 
  Thanks
 
  Gary
 
 
 
 I would have thought it was obvious, the file assessresult.inc.php is
 being called before your session_start(). Have you put your code before
 every include?


 Ash
 www.ashleysheridan.co.uk


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Gary
Ashley

Thanks for your reply, but no, that is not it.  There was no other code 
prior.

Gary
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1240945179.3494.61.ca...@localhost.localdomain...
 On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
 I am trying to set a cookie and a session, but seem to be running into a
 wall.

 I have tried different variations, and keep getting the same error 
 message

 If I have this

 ?php

 session_start();

 I get this:
 Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: session_start() [function.session-start]: Cannot send session 
 cache
 limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 If I have this:
 session_start();

 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 I get this


 Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: session_start() [function.session-start]: Cannot send session 
 cache
 limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 6

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 7

 If I delete and start over, I stll get the headers already sent... I 
 have
 tried numerous other variations, but all with the same error.

 What am I missing here?

 Thanks

 Gary



 I would have thought it was obvious, the file assessresult.inc.php is
 being called before your session_start(). Have you put your code before
 every include?


 Ash
 www.ashleysheridan.co.uk
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Ashley Sheridan
On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
 Ashley
 
 Thanks for your reply, but no, that is not it.  There was no other code 
 prior.
 
 Gary
 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
 news:1240945179.3494.61.ca...@localhost.localdomain...
  On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
  I am trying to set a cookie and a session, but seem to be running into a
  wall.
 
  I have tried different variations, and keep getting the same error 
  message
 
  If I have this
 
  ?php
 
  session_start();
 
  I get this:
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session 
  cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  If I have this:
  session_start();
 
  setcookie('sale_cookie','$sale_value', time()-3600);
  setcookie('assess_cookie','$assess_value', time()-3600);
  I get this
 
 
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session 
  cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: Cannot modify header information - headers already sent by 
  (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
 
  Warning: Cannot modify header information - headers already sent by 
  (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
 
  If I delete and start over, I stll get the headers already sent... I 
  have
  tried numerous other variations, but all with the same error.
 
  What am I missing here?
 
  Thanks
 
  Gary
 
 
 
  I would have thought it was obvious, the file assessresult.inc.php is
  being called before your session_start(). Have you put your code before
  every include?
 
 
  Ash
  www.ashleysheridan.co.uk
  
 
 
 
The code is being pulled in from somewhere, have you checked to see if
the framework you are using is pulling it in?


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Gary
Igor

Thanks for the link.  It was suggested that I must put the session_start() 
before all code on the parent page.  I am no longer getting the error 
messages,so I am assuming I am making progress, however I have yet to be 
able to get the $_SESSION or $_COOKIE to produce results...such as the 
ability to echo them.

Thanks for your help.

Gary


Igor Escobar titiolin...@gmail.com wrote in message 
news:1f5251d50904281208g35fcc98t696b51a4bfc74...@mail.gmail.com...
 http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/


 Regards,
 Igor Escobar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan
 a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
  I am trying to set a cookie and a session, but seem to be running into 
  a
  wall.
 
  I have tried different variations, and keep getting the same error
 message
 
  If I have this
 
  ?php
 
  session_start();
 
  I get this:
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session
 cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  If I have this:
  session_start();
 
  setcookie('sale_cookie','$sale_value', time()-3600);
  setcookie('assess_cookie','$assess_value', time()-3600);
  I get this
 
 
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session
 cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: Cannot modify header information - headers already sent by
 (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
 
  Warning: Cannot modify header information - headers already sent by
 (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
 
  If I delete and start over, I stll get the headers already sent... I
 have
  tried numerous other variations, but all with the same error.
 
  What am I missing here?
 
  Thanks
 
  Gary
 
 
 
 I would have thought it was obvious, the file assessresult.inc.php is
 being called before your session_start(). Have you put your code before
 every include?


 Ash
 www.ashleysheridan.co.uk


 --
 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: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Gary
Ashley

There are 3 include files, the first is all html, but it has a form, so I 
put the session_start above the DTD and I no longer get the error messages.

I had the session_start at the beginning of the second file, the php 
processing file, but that produced the error.  It seemed to be calling to 
itself (if that does not sound too naive).

As I mentioned in a post above, I am no longer getting the error message, 
but have been unable to get either the $_SESSION or the cookie to produce 
results...

Thanks for your help.

Gary
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1240947209.3494.65.ca...@localhost.localdomain...
 On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
 Ashley

 Thanks for your reply, but no, that is not it.  There was no other code
 prior.

 Gary
 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
 news:1240945179.3494.61.ca...@localhost.localdomain...
  On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
  I am trying to set a cookie and a session, but seem to be running into 
  a
  wall.
 
  I have tried different variations, and keep getting the same error
  message
 
  If I have this
 
  ?php
 
  session_start();
 
  I get this:
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session
  cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  If I have this:
  session_start();
 
  setcookie('sale_cookie','$sale_value', time()-3600);
  setcookie('assess_cookie','$assess_value', time()-3600);
  I get this
 
 
  Warning: session_start() [function.session-start]: Cannot send session
  cookie - headers already sent by (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: session_start() [function.session-start]: Cannot send session
  cache
  limiter - headers already sent (output started at
  C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
 
  Warning: Cannot modify header information - headers already sent by
  (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
 
  Warning: Cannot modify header information - headers already sent by
  (output
  started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
  C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
 
  If I delete and start over, I stll get the headers already sent... I
  have
  tried numerous other variations, but all with the same error.
 
  What am I missing here?
 
  Thanks
 
  Gary
 
 
 
  I would have thought it was obvious, the file assessresult.inc.php is
  being called before your session_start(). Have you put your code before
  every include?
 
 
  Ash
  www.ashleysheridan.co.uk
 



 The code is being pulled in from somewhere, have you checked to see if
 the framework you are using is pulling it in?


 Ash
 www.ashleysheridan.co.uk
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Ashley Sheridan
On Tue, 2009-04-28 at 15:34 -0400, Gary wrote:
 Ashley
 
 There are 3 include files, the first is all html, but it has a form, so I 
 put the session_start above the DTD and I no longer get the error messages.
 
 I had the session_start at the beginning of the second file, the php 
 processing file, but that produced the error.  It seemed to be calling to 
 itself (if that does not sound too naive).
 
 As I mentioned in a post above, I am no longer getting the error message, 
 but have been unable to get either the $_SESSION or the cookie to produce 
 results...
 
 Thanks for your help.
 
 Gary
 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
 news:1240947209.3494.65.ca...@localhost.localdomain...
  On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
  Ashley
 
  Thanks for your reply, but no, that is not it.  There was no other code
  prior.
 
  Gary
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1240945179.3494.61.ca...@localhost.localdomain...
   On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
   I am trying to set a cookie and a session, but seem to be running into 
   a
   wall.
  
   I have tried different variations, and keep getting the same error
   message
  
   If I have this
  
   ?php
  
   session_start();
  
   I get this:
   Warning: session_start() [function.session-start]: Cannot send session
   cookie - headers already sent by (output started at
   C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
   C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
  
   Warning: session_start() [function.session-start]: Cannot send session
   cache
   limiter - headers already sent (output started at
   C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
   C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
  
   If I have this:
   session_start();
  
   setcookie('sale_cookie','$sale_value', time()-3600);
   setcookie('assess_cookie','$assess_value', time()-3600);
   I get this
  
  
   Warning: session_start() [function.session-start]: Cannot send session
   cookie - headers already sent by (output started at
   C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
   C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
  
   Warning: session_start() [function.session-start]: Cannot send session
   cache
   limiter - headers already sent (output started at
   C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
   C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
  
   Warning: Cannot modify header information - headers already sent by
   (output
   started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
   C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
  
   Warning: Cannot modify header information - headers already sent by
   (output
   started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
   C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
  
   If I delete and start over, I stll get the headers already sent... I
   have
   tried numerous other variations, but all with the same error.
  
   What am I missing here?
  
   Thanks
  
   Gary
  
  
  
   I would have thought it was obvious, the file assessresult.inc.php is
   being called before your session_start(). Have you put your code before
   every include?
  
  
   Ash
   www.ashleysheridan.co.uk
  
 
 
 
  The code is being pulled in from somewhere, have you checked to see if
  the framework you are using is pulling it in?
 
 
  Ash
  www.ashleysheridan.co.uk
  
 
 
 
There it is then. The HTML file causes the headers to be sent. Any
output to the browser at all causes the headers to be sent, so any HTML
or even spaces and newlines will trigger this error.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Gary
Thanks again, dont see any DOM

As I mentioned I am no longer getting error message, but not sure it is 
working.

I have this at the begining of the first file.

?php
session_start();
setcookie('sale_cookie','$sale_value', time()-3600);
setcookie('assess_cookie','$assess_value', time()-3600);

if (isset($_COOKIE['sale_cookie'])  isset($_COOKIE['assess_cookie'])) 
{
  $_SESSION['sale_value'] = $_COOKIE['sale_cookie'];
  $_SESSION['assess_value'] = $_COOKIE['assess_cookie'];
}

?



I have tried this

echo $sale_value;
echo $_SESSION['assess_value'];
echo $_COOKIE['sale_cookie'];

I have also removed all of the if() and still not had success

None of which are producing results...

Anyone see where I am going wrong... I have spent all day online, in the 
books, in the manual...

Thanks again

gary



Igor Escobar titiolin...@gmail.com wrote in message 
news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com...
 Make sure your file isn't a UTF-8 with DOM.


 Regards,
 Igor Escobar
 Systems Analyst  Interface Designer

 --

 Personal Blog
 ~ blog.igorescobar.com
 Online Portifolio
 ~ www.igorescobar.com
 Twitter
 ~ @igorescobar





 On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan
 a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-04-28 at 15:34 -0400, Gary wrote:
  Ashley
 
  There are 3 include files, the first is all html, but it has a form, so 
  I
  put the session_start above the DTD and I no longer get the error
 messages.
 
  I had the session_start at the beginning of the second file, the php
  processing file, but that produced the error.  It seemed to be calling 
  to
  itself (if that does not sound too naive).
 
  As I mentioned in a post above, I am no longer getting the error 
  message,
  but have been unable to get either the $_SESSION or the cookie to 
  produce
  results...
 
  Thanks for your help.
 
  Gary
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1240947209.3494.65.ca...@localhost.localdomain...
   On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
   Ashley
  
   Thanks for your reply, but no, that is not it.  There was no other
 code
   prior.
  
   Gary
   Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
   news:1240945179.3494.61.ca...@localhost.localdomain...
On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
I am trying to set a cookie and a session, but seem to be running
 into
a
wall.
   
I have tried different variations, and keep getting the same 
error
message
   
If I have this
   
?php
   
session_start();
   
I get this:
Warning: session_start() [function.session-start]: Cannot send
 session
cookie - headers already sent by (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
Warning: session_start() [function.session-start]: Cannot send
 session
cache
limiter - headers already sent (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
If I have this:
session_start();
   
setcookie('sale_cookie','$sale_value', time()-3600);
setcookie('assess_cookie','$assess_value', time()-3600);
I get this
   
   
Warning: session_start() [function.session-start]: Cannot send
 session
cookie - headers already sent by (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
Warning: session_start() [function.session-start]: Cannot send
 session
cache
limiter - headers already sent (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
Warning: Cannot modify header information - headers already sent 
by
(output
started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
   
Warning: Cannot modify header information - headers already sent 
by
(output
started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
   
If I delete and start over, I stll get the headers already
 sent... I
have
tried numerous other variations, but all with the same error.
   
What am I missing here?
   
Thanks
   
Gary
   
   
   
I would have thought it was obvious, the file assessresult.inc.php
 is
being called before your session_start(). Have you put your code
 before
every include?
   
   
Ash
www.ashleysheridan.co.uk
   
  
  
  
   The code is being pulled in from somewhere, have you checked to see 
   if
   the framework you are using is pulling it in?
  
  
   Ash
   www.ashleysheridan.co.uk
  
 
 
 
 There it is then. The HTML file causes the headers to be sent. Any
 output to the browser at all causes the headers to be sent, so any HTML
 or even spaces and 

Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Ashley Sheridan
On Tue, 2009-04-28 at 16:38 -0400, Gary wrote:
 Thanks again, dont see any DOM
 
 As I mentioned I am no longer getting error message, but not sure it is 
 working.
 
 I have this at the begining of the first file.
 
 ?php
 session_start();
 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 
 if (isset($_COOKIE['sale_cookie'])  isset($_COOKIE['assess_cookie'])) 
 {
   $_SESSION['sale_value'] = $_COOKIE['sale_cookie'];
   $_SESSION['assess_value'] = $_COOKIE['assess_cookie'];
 }
 
 ?
 
 
 
 I have tried this
 
 echo $sale_value;
 echo $_SESSION['assess_value'];
 echo $_COOKIE['sale_cookie'];
 
 I have also removed all of the if() and still not had success
 
 None of which are producing results...
 
 Anyone see where I am going wrong... I have spent all day online, in the 
 books, in the manual...
 
 Thanks again
 
 gary
 
 
 
 Igor Escobar titiolin...@gmail.com wrote in message 
 news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com...
  Make sure your file isn't a UTF-8 with DOM.
 
 
  Regards,
  Igor Escobar
  Systems Analyst  Interface Designer
 
  --
 
  Personal Blog
  ~ blog.igorescobar.com
  Online Portifolio
  ~ www.igorescobar.com
  Twitter
  ~ @igorescobar
 
 
 
 
 
  On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan
  a...@ashleysheridan.co.ukwrote:
 
  On Tue, 2009-04-28 at 15:34 -0400, Gary wrote:
   Ashley
  
   There are 3 include files, the first is all html, but it has a form, so 
   I
   put the session_start above the DTD and I no longer get the error
  messages.
  
   I had the session_start at the beginning of the second file, the php
   processing file, but that produced the error.  It seemed to be calling 
   to
   itself (if that does not sound too naive).
  
   As I mentioned in a post above, I am no longer getting the error 
   message,
   but have been unable to get either the $_SESSION or the cookie to 
   produce
   results...
  
   Thanks for your help.
  
   Gary
   Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
   news:1240947209.3494.65.ca...@localhost.localdomain...
On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
Ashley
   
Thanks for your reply, but no, that is not it.  There was no other
  code
prior.
   
Gary
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1240945179.3494.61.ca...@localhost.localdomain...
 On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
 I am trying to set a cookie and a session, but seem to be running
  into
 a
 wall.

 I have tried different variations, and keep getting the same 
 error
 message

 If I have this

 ?php

 session_start();

 I get this:
 Warning: session_start() [function.session-start]: Cannot send
  session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: session_start() [function.session-start]: Cannot send
  session
 cache
 limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 If I have this:
 session_start();

 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 I get this


 Warning: session_start() [function.session-start]: Cannot send
  session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: session_start() [function.session-start]: Cannot send
  session
 cache
 limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: Cannot modify header information - headers already sent 
 by
 (output
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 6

 Warning: Cannot modify header information - headers already sent 
 by
 (output
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 7

 If I delete and start over, I stll get the headers already
  sent... I
 have
 tried numerous other variations, but all with the same error.

 What am I missing here?

 Thanks

 Gary



 I would have thought it was obvious, the file assessresult.inc.php
  is
 being called before your session_start(). Have you put your code
  before
 every include?


 Ash
 www.ashleysheridan.co.uk

   
   
   
The code is being pulled in from somewhere, have you checked to see 
if
the framework you 

Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Andrew Hucks
Take the values out of single quotes, else it sets them as strings,
and not as the variable value. Also, are you meaning to set the
cookie's expiration to time()-3600? Try time()+3600.

On Tue, Apr 28, 2009 at 4:49 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Tue, 2009-04-28 at 16:38 -0400, Gary wrote:
 Thanks again, dont see any DOM

 As I mentioned I am no longer getting error message, but not sure it is
 working.

 I have this at the begining of the first file.

 ?php
 session_start();
 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);

     if (isset($_COOKIE['sale_cookie'])  isset($_COOKIE['assess_cookie']))
 {
       $_SESSION['sale_value'] = $_COOKIE['sale_cookie'];
       $_SESSION['assess_value'] = $_COOKIE['assess_cookie'];
     }

 ?



 I have tried this

 echo $sale_value;
 echo $_SESSION['assess_value'];
 echo $_COOKIE['sale_cookie'];

 I have also removed all of the if() and still not had success

 None of which are producing results...

 Anyone see where I am going wrong... I have spent all day online, in the
 books, in the manual...

 Thanks again

 gary



 Igor Escobar titiolin...@gmail.com wrote in message
 news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com...
  Make sure your file isn't a UTF-8 with DOM.
 
 
  Regards,
  Igor Escobar
  Systems Analyst  Interface Designer
 
  --
 
  Personal Blog
  ~ blog.igorescobar.com
  Online Portifolio
  ~ www.igorescobar.com
  Twitter
  ~ @igorescobar
 
 
 
 
 
  On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan
  a...@ashleysheridan.co.ukwrote:
 
  On Tue, 2009-04-28 at 15:34 -0400, Gary wrote:
   Ashley
  
   There are 3 include files, the first is all html, but it has a form, so
   I
   put the session_start above the DTD and I no longer get the error
  messages.
  
   I had the session_start at the beginning of the second file, the php
   processing file, but that produced the error.  It seemed to be calling
   to
   itself (if that does not sound too naive).
  
   As I mentioned in a post above, I am no longer getting the error
   message,
   but have been unable to get either the $_SESSION or the cookie to
   produce
   results...
  
   Thanks for your help.
  
   Gary
   Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
   news:1240947209.3494.65.ca...@localhost.localdomain...
On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
Ashley
   
Thanks for your reply, but no, that is not it.  There was no other
  code
prior.
   
Gary
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1240945179.3494.61.ca...@localhost.localdomain...
 On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
 I am trying to set a cookie and a session, but seem to be running
  into
 a
 wall.

 I have tried different variations, and keep getting the same
 error
 message

 If I have this

 ?php

 session_start();

 I get this:
 Warning: session_start() [function.session-start]: Cannot send
  session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: session_start() [function.session-start]: Cannot send
  session
 cache
 limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 If I have this:
 session_start();

 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 I get this


 Warning: session_start() [function.session-start]: Cannot send
  session
 cookie - headers already sent by (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: session_start() [function.session-start]: Cannot send
  session
 cache
 limiter - headers already sent (output started at
 C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 4

 Warning: Cannot modify header information - headers already sent
 by
 (output
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 6

 Warning: Cannot modify header information - headers already sent
 by
 (output
 started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
 C:\xampp\htdocs\weiss\assessresult.inc.php on line 7

 If I delete and start over, I stll get the headers already
  sent... I
 have
 tried numerous other variations, but all with the same error.

 What am I missing here?

 Thanks

 Gary



 I would have thought it was obvious, the file assessresult.inc.php
  is
 being called before 

Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Igor Escobar
Make sure your file isn't a UTF-8 with DOM.


Regards,
Igor Escobar
Systems Analyst  Interface Designer

--

Personal Blog
~ blog.igorescobar.com
Online Portifolio
~ www.igorescobar.com
Twitter
~ @igorescobar





On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-04-28 at 15:34 -0400, Gary wrote:
  Ashley
 
  There are 3 include files, the first is all html, but it has a form, so I
  put the session_start above the DTD and I no longer get the error
 messages.
 
  I had the session_start at the beginning of the second file, the php
  processing file, but that produced the error.  It seemed to be calling to
  itself (if that does not sound too naive).
 
  As I mentioned in a post above, I am no longer getting the error message,
  but have been unable to get either the $_SESSION or the cookie to produce
  results...
 
  Thanks for your help.
 
  Gary
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1240947209.3494.65.ca...@localhost.localdomain...
   On Tue, 2009-04-28 at 15:24 -0400, Gary wrote:
   Ashley
  
   Thanks for your reply, but no, that is not it.  There was no other
 code
   prior.
  
   Gary
   Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
   news:1240945179.3494.61.ca...@localhost.localdomain...
On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
I am trying to set a cookie and a session, but seem to be running
 into
a
wall.
   
I have tried different variations, and keep getting the same error
message
   
If I have this
   
?php
   
session_start();
   
I get this:
Warning: session_start() [function.session-start]: Cannot send
 session
cookie - headers already sent by (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
Warning: session_start() [function.session-start]: Cannot send
 session
cache
limiter - headers already sent (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
If I have this:
session_start();
   
setcookie('sale_cookie','$sale_value', time()-3600);
setcookie('assess_cookie','$assess_value', time()-3600);
I get this
   
   
Warning: session_start() [function.session-start]: Cannot send
 session
cookie - headers already sent by (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
Warning: session_start() [function.session-start]: Cannot send
 session
cache
limiter - headers already sent (output started at
C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
   
Warning: Cannot modify header information - headers already sent by
(output
started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
   
Warning: Cannot modify header information - headers already sent by
(output
started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
   
If I delete and start over, I stll get the headers already
 sent... I
have
tried numerous other variations, but all with the same error.
   
What am I missing here?
   
Thanks
   
Gary
   
   
   
I would have thought it was obvious, the file assessresult.inc.php
 is
being called before your session_start(). Have you put your code
 before
every include?
   
   
Ash
www.ashleysheridan.co.uk
   
  
  
  
   The code is being pulled in from somewhere, have you checked to see if
   the framework you are using is pulling it in?
  
  
   Ash
   www.ashleysheridan.co.uk
  
 
 
 
 There it is then. The HTML file causes the headers to be sent. Any
 output to the browser at all causes the headers to be sent, so any HTML
 or even spaces and newlines will trigger this error.


 Ash
 www.ashleysheridan.co.uk


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Lists

Gary wrote:

Thanks again, dont see any DOM

As I mentioned I am no longer getting error message, but not sure it is 
working.


I have this at the begining of the first file.

?php
session_start();
setcookie('sale_cookie','$sale_value', time()-3600);
setcookie('assess_cookie','$assess_value', time()-3600);

if (isset($_COOKIE['sale_cookie'])  isset($_COOKIE['assess_cookie'])) 
{

  $_SESSION['sale_value'] = $_COOKIE['sale_cookie'];
  $_SESSION['assess_value'] = $_COOKIE['assess_cookie'];
}

?



I have tried this

echo $sale_value;
echo $_SESSION['assess_value'];
echo $_COOKIE['sale_cookie'];

I have also removed all of the if() and still not had success

None of which are producing results...

Anyone see where I am going wrong... I have spent all day online, in the 
books, in the manual...


Thanks again

gary



Looks to me like you are trying to set and retrieve a cookie on the same
page. It doesn't work that way. Set it, access it on the next page... 
or, set it, and then redirect to the same page.. being sure to send a 
flag to hide the setcookie function to avoid the dreaded infinite loop.


Also, Setting a cookie's expire param to history will delete it... so
I don't think that is what you want to do.

Donovan




--
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  D. BROOKE   EUCA Design Center
   WebDNA Software Corp.
  WEB: http://www.euca.us  |   http://www.webdna.us
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  WebDNA: [** Square Bracket Utopia **]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Shawn McKenzie
Gary wrote:
 Thanks again, dont see any DOM
 
 As I mentioned I am no longer getting error message, but not sure it is 
 working.
 
 I have this at the begining of the first file.
 
 ?php
 session_start();
 setcookie('sale_cookie','$sale_value', time()-3600);
 setcookie('assess_cookie','$assess_value', time()-3600);
 
 if (isset($_COOKIE['sale_cookie'])  isset($_COOKIE['assess_cookie'])) 
 {
   $_SESSION['sale_value'] = $_COOKIE['sale_cookie'];
   $_SESSION['assess_value'] = $_COOKIE['assess_cookie'];
 }
 
 ?
 
 
 
 I have tried this
 
 echo $sale_value;
 echo $_SESSION['assess_value'];
 echo $_COOKIE['sale_cookie'];
 
 I have also removed all of the if() and still not had success
 
 None of which are producing results...
 
 Anyone see where I am going wrong... I have spent all day online, in the 
 books, in the manual...
 
 Thanks again
 
 gary

Maybe I'm missing something, but why are you using session vars and
cookie vars like you are?  If you start a session it creates a cookie to
track the session and the session persists your session vars.  Why not
just use session vars?

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION lost

2008-05-16 Thread Daniel Brown
On Fri, May 16, 2008 at 12:36 AM, hce [EMAIL PROTECTED] wrote:
 Hi,

 I've just installed PHP 5.2.4 on a FC 7 with a web server.

 $ php -v
 PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58)
 Copyright (c) 1997-2007 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

That's the CLI version, which is likely completely different from
your web version.  They're generally two separate binaries.

 It seems some PHP module might be missing, I tested it with a page1.php:

Sessions are handled in the core, not in a module.

 session_start();
 $_SESSION['favcolor'] = 'green';

 Then I click a link in page1.php to go another page2.php:

 session_start();
 echo favcolr = . $_SESSION['favcolor'];

 It only displayed favcolr =, it was empty in $_SESSION['favcolor'].
 The test script page1.php and page2.php are working fine on other
 machines.

Send the actual code and we can take a look at it.  It's probably
something as simple as a typo.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION lost

2008-05-15 Thread Chris

 $ php -v
 PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58)
 Copyright (c) 1997-2007 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

This shows the php command line version, not the webserver php version.
To do that, look at a phpinfo() page. They may indeed be the same but
don't think that they always will be. I can run php4 for my webserver
version and php5 command line and vice-versa.

 It seems some PHP module might be missing, I tested it with a page1.php:

More likely the session.save_path is either not writable or not
accessible by this script.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Dmitri

Try adding session_start() at top of the script

Balpo wrote:


Hi everyone,
I'm having a problem moving my code to a linux computer.
I won't post the whole code here, but an accurate example that 
reproduces exactly the error.


// 1.php
?php
session_register('tree');
$_SESSION['tree'] = This is tree number one;
header(Location: 2.php);
?

// 2.php
?php
print_r($_SESSION, false);
?


// php.ini (incomplete)
session.save_handler = files
session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for 
Windows

session.use_cookies = 1
session.name = cito
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 0
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags = 
a=href,area=href,frame=src,input=src,form=,fieldset=


The web server is Apache 2.2 with php 5.24 for both, Linux  Windows.
In Linux the Apache server is run by the 'apache' user, which has 
reading, writing and execution grants on /tmp/php/sessions/


The output for 2.php is:
 Array ( [tree] = This is tree number one )
is what I get on Windows, but on Linux I get:
Notice: Undefined variable: _SESSION in /var/www/html/2.php on 
line 2


I don't know what the error is, but something evident is that on Linux 
session.auto_start = 1 is NOT working properly.
On Windows it is not necessary to explicitly start the session to use 
the $_SESSION, so no need to session_start().
If on Linux I add session_start() at the top of each script, the 
script executes well.


I want to know why session.auto_start does not work on Linux.

If you require the whole php.ini, I'll send it gladly




--

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Daniel Brown
On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote:
 Hi everyone,
  I'm having a problem moving my code to a linux computer.
  I won't post the whole code here, but an accurate example that reproduces
 exactly the error.
[snip!]

Modify 2.php as follows:

?php
session_start();
print_r($_SESSION);
?

You only missed instantiating the session.  The rest looks good.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Balpo

Yes, that way it works. Thanx.
But the Windows version of the same code and the same php.ini ***does 
not *** need the session_start()

because it has the session.auto_start = 1 inside php.ini.

The thing is,  I think session.auto_start = 1 does not work on Linux.

Is this a bug?

Daniel Brown wrote:

On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote:
  

Hi everyone,
 I'm having a problem moving my code to a linux computer.
 I won't post the whole code here, but an accurate example that reproduces
exactly the error.


[snip!]

Modify 2.php as follows:

?php
session_start();
print_r($_SESSION);
?

You only missed instantiating the session.  The rest looks good.

  


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] $_SESSION NOT WORKING

2008-05-13 Thread Jens Himmelrath
Balpo schrieb:
 Hi everyone, I'm having a problem moving my code to a linux 
 computer. I won't post the whole code here, but an accurate example
  that reproduces exactly the error.
 
 // 1.php ?php session_register('tree'); 
 $_SESSION['tree'] = This is tree number one; header(Location:
 2.php); ?
 
 // 2.php ?php print_r($_SESSION, false); 
 ?
 
 session.auto_start = 1
 
 I want to know why session.auto_start does not work on Linux.
 
 If you require the whole php.ini, I'll send it gladly

Hi!

Did you test with phpinfo() if the correct php.ini is used?

regards,
Jens


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-11 Thread Craige Leeder
I can't see PHP sessions slowing down your site by that amount. As
someone said, it should be no more than a split second. If you are
having that much of a problem with them, then I would say it is either
your implementation, or another determining factor.

I would not, personally, stray away from PHP's GC of sessions. I would
imagine that any third-party concoction could not be any faster. I
would however, check to see how long PHP takes to clean up defunct
sessions, and also monitor how many sessions are lying around at any
given time.

Regards,
- Craige

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-08 Thread Németh Zoltán
 On Wed, May 7, 2008 at 2:35 PM, Robert Cummings [EMAIL PROTECTED]
 wrote:


 On Wed, 2008-05-07 at 14:29 -0600, Nathan Nobbe wrote:
  On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED]
  wrote:
 
  On Wed, 2008-05-07 at 16:03 -0400, tedd wrote:
   At 12:34 PM -0400 5/7/08, Robert Cummings wrote:
   
   The exception being when it performs cleanup. Cleanup
  should be
   relegated to a cron job.
  
   Rob:
  
   What clean-up?
 
 
  All the inactive session files... inactive and garbage
  collection time
  is denoted by the following php.ini settings:
 
  session.gc_probability= 1 ; percentual probability
  that the
   ; 'garbage collection'
  process is
   ; started
   ; on every session
  initialization
  session.gc_maxlifetime= 1440  ; after this number of
  seconds,
   ; stored data will be seen as
   ; 'garbage' and cleaned up by
  the
   ; gc process
 
  so where is the setting, using the stock session handler, to relegate
  the gc process to a cron job ?

 session.gc_probability = 0


 but wont it still try to run sometimes since that setting determines
 whether
 or not the gc will run *every* time ?  i would imagine if it was for *any*
 time, setting session.gc_probability = 0 would effectively disable the
 stock
 gc.


that setting is the chance (in percents) for the stock gc to run at any
request. so if it is set to 0, it does not have a chance ;)
of course it will try but it always decides not to run

greets,
Zoltán Németh

 Then do it yourself in a script called by cron.


 it would be nice if you could latch into the one they provide out of the
 box
 and just invoke it via cron..

 -nathan




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread Robert Cummings

On Wed, 2008-05-07 at 12:27 -0400, Scott Campbell wrote:
 Dear PHP List,
 
 PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing  deving with
 FireFox and Konqueror (Linux).
 
 I am building a site with multiple tools and want to pass variables
 throughout them all.  Before, I was passing variables using hidden HTML
 Form tags, but the site has grown too large for this tactic, so I went to
 using $_SESSION.  However, when I started using $_SESSION, my site loads 3-5
 times slower then before.  A page that queried MySQL and built itself in 3-5
 seconds was now taking 15-20.  While more has changed then just $_SESSION,
 it is really the only significant difference.
 
 Is $_SESSION slowing down my site?  Is there a faster alternative to
 global variables then using $_SESSION?  Are using regular cookies faster?
 
 Any help is appreciated.

How are your sessions implemented? Are you using the stock PHP session
functionality or did you cook your own solution? I can't see the stock
PHP solution adding anything more than a split second to your page time.
The exception being when it performs cleanup. Cleanup should be
relegated to a cron job. Have you added anything new to the database?
new query perhaps on a large table that doesn't make use of indexes?
Small changes can have a bigger impact than large changes depending on
what exactly changed.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread Wolf

 Scott Campbell [EMAIL PROTECTED] wrote: 
 Dear PHP List,
 
 PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing  deving with
 FireFox and Konqueror (Linux).
 
 I am building a site with multiple tools and want to pass variables
 throughout them all.  Before, I was passing variables using hidden HTML
 Form tags, but the site has grown too large for this tactic, so I went to
 using $_SESSION.  However, when I started using $_SESSION, my site loads 3-5
 times slower then before.  A page that queried MySQL and built itself in 3-5
 seconds was now taking 15-20.  While more has changed then just $_SESSION,
 it is really the only significant difference.
 
 Is $_SESSION slowing down my site?  Is there a faster alternative to
 global variables then using $_SESSION?  Are using regular cookies faster?
 
 Any help is appreciated.
 
 Thanks,
   Scott

Did you add any includes and are they include or include_once or require VS. 
require_once?

I found stress tests that show that an include is faster then an include_once 
and so removing the _once from includes and requires will speed up your site.

HTH,
Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread tedd

At 12:34 PM -0400 5/7/08, Robert Cummings wrote:


The exception being when it performs cleanup. Cleanup should be
relegated to a cron job.


Rob:

What clean-up?

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread Robert Cummings

On Wed, 2008-05-07 at 16:03 -0400, tedd wrote:
 At 12:34 PM -0400 5/7/08, Robert Cummings wrote:
 
 The exception being when it performs cleanup. Cleanup should be
 relegated to a cron job.
 
 Rob:
 
 What clean-up?

All the inactive session files... inactive and garbage collection time
is denoted by the following php.ini settings:

session.gc_probability= 1 ; percentual probability that the 
  ; 'garbage collection' process is
  ; started
  ; on every session initialization
session.gc_maxlifetime= 1440  ; after this number of seconds,
  ; stored data will be seen as
  ; 'garbage' and cleaned up by the
  ; gc process

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread Nathan Nobbe
On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED]
wrote:


 On Wed, 2008-05-07 at 16:03 -0400, tedd wrote:
  At 12:34 PM -0400 5/7/08, Robert Cummings wrote:
  
  The exception being when it performs cleanup. Cleanup should be
  relegated to a cron job.
 
  Rob:
 
  What clean-up?

 All the inactive session files... inactive and garbage collection time
 is denoted by the following php.ini settings:

 session.gc_probability= 1 ; percentual probability that the
  ; 'garbage collection' process is
  ; started
  ; on every session initialization
 session.gc_maxlifetime= 1440  ; after this number of seconds,
  ; stored data will be seen as
  ; 'garbage' and cleaned up by the
  ; gc process


so where is the setting, using the stock session handler, to relegate the gc
process to a cron job ?

-nathan


Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread tedd

At 4:22 PM -0400 5/7/08, Robert Cummings wrote:

On Wed, 2008-05-07 at 16:03 -0400, tedd wrote:

 At 12:34 PM -0400 5/7/08, Robert Cummings wrote:
 
 The exception being when it performs cleanup. Cleanup should be
 relegated to a cron job.

 Rob:

 What clean-up?


All the inactive session files... inactive and garbage collection time
is denoted by the following php.ini settings:

session.gc_probability= 1 ; percentual probability that the
  ; 'garbage collection' process is
  ; started
  ; on every session initialization
session.gc_maxlifetime= 1440  ; after this number of seconds,
  ; stored data will be seen as
  ; 'garbage' and cleaned up by the
  ; gc process

Cheers,
Rob.


Oh, Okay. That's an automatic practice taken from the php.ini 
settings. I was thinking that maybe one was supposed to do something 
after using sessions.


Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread Robert Cummings

On Wed, 2008-05-07 at 14:29 -0600, Nathan Nobbe wrote:
 On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED]
 wrote:
 
 On Wed, 2008-05-07 at 16:03 -0400, tedd wrote:
  At 12:34 PM -0400 5/7/08, Robert Cummings wrote:
  
  The exception being when it performs cleanup. Cleanup
 should be
  relegated to a cron job.
 
  Rob:
 
  What clean-up?
 
 
 All the inactive session files... inactive and garbage
 collection time
 is denoted by the following php.ini settings:
 
 session.gc_probability= 1 ; percentual probability
 that the
  ; 'garbage collection'
 process is
  ; started
  ; on every session
 initialization
 session.gc_maxlifetime= 1440  ; after this number of
 seconds,
  ; stored data will be seen as
  ; 'garbage' and cleaned up by
 the
  ; gc process
 
 so where is the setting, using the stock session handler, to relegate
 the gc process to a cron job ?

session.gc_probability = 0

Then do it yourself in a script called by cron.

Cheers,
Rob.

-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION v. Cookies

2008-05-07 Thread Nathan Nobbe
On Wed, May 7, 2008 at 2:35 PM, Robert Cummings [EMAIL PROTECTED]
wrote:


 On Wed, 2008-05-07 at 14:29 -0600, Nathan Nobbe wrote:
  On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED]
  wrote:
 
  On Wed, 2008-05-07 at 16:03 -0400, tedd wrote:
   At 12:34 PM -0400 5/7/08, Robert Cummings wrote:
   
   The exception being when it performs cleanup. Cleanup
  should be
   relegated to a cron job.
  
   Rob:
  
   What clean-up?
 
 
  All the inactive session files... inactive and garbage
  collection time
  is denoted by the following php.ini settings:
 
  session.gc_probability= 1 ; percentual probability
  that the
   ; 'garbage collection'
  process is
   ; started
   ; on every session
  initialization
  session.gc_maxlifetime= 1440  ; after this number of
  seconds,
   ; stored data will be seen as
   ; 'garbage' and cleaned up by
  the
   ; gc process
 
  so where is the setting, using the stock session handler, to relegate
  the gc process to a cron job ?

 session.gc_probability = 0


but wont it still try to run sometimes since that setting determines whether
or not the gc will run *every* time ?  i would imagine if it was for *any*
time, setting session.gc_probability = 0 would effectively disable the stock
gc.

Then do it yourself in a script called by cron.


it would be nice if you could latch into the one they provide out of the box
and just invoke it via cron..

-nathan


Re: [PHP] $_SESSION problem [NOW SOLVED]

2008-04-14 Thread Andrew Ballard
On Fri, Apr 11, 2008 at 5:34 PM, tedd [EMAIL PROTECTED] wrote:
 At 11:33 AM -0400 4/11/08, Daniel Brown wrote:

  On Fri, Apr 11, 2008 at 10:29 AM, Ford, Mike [EMAIL PROTECTED]
 wrote:
 
  
Sounds like a register_globals=On issue
  
 
 It does to me, as well.  I know, Tedd, that on the php1.net site
  that you mentioned to me off-list, I'm about 99% positive that it's
  the reason.  Shared hosts generally keep register_globals on and leave
  it up to the individual customer to turn it off.  On that particular
  server, though, since it's mostly developers, I may just send out an
  email to get feedback and turn it off at the main, and then allow
  ya'all to override it on your individual sites.
 
 The thing that makes me wonder (and I haven't checked myself to
  verify) is why two sites, on the same server, having the same
 

  Hey!

  I found it and you were right.

  On my webbytedd.com site, I had a htaccess file that read:

  AddDefaultCharset utf-8

  php_value register_globals 0
  php_value magic_quotes_gpc 0
  php_value magic_quotes_sybase 0
  php_value magic_quotes_runtime 0

  And I didn't have that htaccess file on my sperling.com site. However, what
 fooled me was in both scripts I had:

  ini_set( 'register_globals', '0' );

  So, I thought that was the same, but apparently it's not. Maybe because my
 server had safe_mode ON it won't allow it -- I don't know. Another question
 for another time.

  Thanks a bunch guys!

  Cheers,

  tedd

  PS: I did try the session_write_close and several other suggestions, but
 none worked.


The register_globals value is something that cannot be set at runtime.
If you pass it to ini_set(), it will appear to work -- you won't get
an error and successive calls to phpinfo() will show the new value;
however, by the time PHP gets far enough down the chain to execute
your ini_set() command, PHP has already determined whether it should
register global variables. The manual indicates that this wasn't
always the case, but (not knowing the internals then or now) I don't
understand how. (The table on that page says it was PHP_INI_ALL for
versions up to 4.2.3.)

http://us.php.net/manual/en/ini.core.php#ini.register-globals

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION problem

2008-04-11 Thread tedd

At 5:10 PM -0600 4/10/08, Nathan Nobbe wrote:
On Thu, Apr 10, 2008 at 5:05 PM, Nathan Nobbe 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote:


On Thu, Apr 10, 2008 at 4:29 PM, tedd 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote:


  you might just dump out the session component of the php config on 
each site to ensure theyre the same.



on that last note, this could be useful,

?php
die(var_dump(ini_get_all('session')));
?

-nathan


They are identical -- and the same as shown in phpInfo, as I said.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

Re: [PHP] $_SESSION problem

2008-04-11 Thread tedd

At 5:05 PM -0600 4/10/08, Nathan Nobbe wrote:
On Thu, Apr 10, 2008 at 4:29 PM, tedd 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote:


Hi gang:

I'm stumped and in need of some expert explanation.

I have prepared two demos (showing code) for your enjoyment:

[1] http://www.webbytedd.com/x/index.phphttp://www.webbytedd.com/x/index.php
[2] http://sperling.com/x/index.phphttp://sperling.com/x/index.php

Both of these demos have the exact same code; and are on the same 
server; with exactly the same php-info -- so, why do they behave 
differently re sessions?


Note that [1] will retain the session values throughout the entire 
session, while [2] does not and loses session values.



as a sanity check have you dumped out the contents of the session 
after writing to it on [2] ?

eg.

?php
// 
 $_SESSION['q6'] = ( isset($_SESSION['q6']) ? $_SESSION['q6'] : 0);
$_SESSION['q7'] = ( isset($_SESSION['q7']) ? $_SESSION['q7'] : 0);

$_SESSION['q8'] = ( isset($_SESSION['q8']) ? $_SESSION['q8'] : 0); 
$_SESSION['q9'] = ( isset($_SESSION['q9']) ? $_SESSION['q9'] : 0);

var_dump($_SESSION);

?
 you might just dump out the session component of the php config on 
each site to ensure theyre the same.


-nathan


Isn't that what the code is doing?

I'm dumping the results in a print_r($_SESSION) -- isn't that he same thing?

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

Re: [PHP] $_SESSION problem [SOLVED (sort-of)]

2008-04-11 Thread tedd

At 10:12 PM -0400 4/10/08, Eric Wood wrote:

tedd wrote:


[1] http://www.webbytedd.com/x/index.php
[2] http://sperling.com/x/index.php

Both of these demos have the exact same code; and are on the same 
server; with exactly the same php-info -- so, why do they behave 
differently re sessions?


Strange.  I've run into issues whenever I use variable names which 
are the same as session variables.  It's as if they step on each 
others toes.  I try to use uniq var names.  I've also recently run 
into customized 401 pages (which you may not see happen, check the 
logs) start up and the session data gets overwrite due to a lack of 
session file locking.

-eric



-eric:

You didn't provide the reason why, but you did provide a solution.

Changing the variable names to be different than the session names 
fixed the problem.


Now, if any php guru would care to tell me why, I would really like to know.

Thanks eric.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION problem [SOLVED (sort-of)]

2008-04-11 Thread Ford, Mike
On 11 April 2008 14:45, tedd advised:

 At 10:12 PM -0400 4/10/08, Eric Wood wrote:
 tedd wrote:
 
 [1] http://www.webbytedd.com/x/index.php
 [2] http://sperling.com/x/index.php
 
 Both of these demos have the exact same code; and are on the same
 server; with exactly the same php-info -- so, why do they behave
 differently re sessions?
 
 Strange.  I've run into issues whenever I use variable names which
 are the same as session variables.  It's as if they step on each
 others toes.  I try to use uniq var names.  I've also recently run
 into customized 401 pages (which you may not see happen, check the
 logs) start up and the session data gets overwrite due to a lack of
 session file locking. -eric
 
 
 -eric:
 
 You didn't provide the reason why, but you did provide a solution.
 
 Changing the variable names to be different than the session names
fixed
 the problem. 
 
 Now, if any php guru would care to tell me why, I would
 really like to know.

Sounds like a register_globals=On issue


 --
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION problem [SOLVED (sort-of)]

2008-04-11 Thread Daniel Brown
On Fri, Apr 11, 2008 at 10:29 AM, Ford, Mike [EMAIL PROTECTED] wrote:

  Sounds like a register_globals=On issue

It does to me, as well.  I know, Tedd, that on the php1.net site
that you mentioned to me off-list, I'm about 99% positive that it's
the reason.  Shared hosts generally keep register_globals on and leave
it up to the individual customer to turn it off.  On that particular
server, though, since it's mostly developers, I may just send out an
email to get feedback and turn it off at the main, and then allow
ya'all to override it on your individual sites.

The thing that makes me wonder (and I haven't checked myself to
verify) is why two sites, on the same server, having the same
phpinfo() output, would have different results.

-- 
/Daniel P. Brown
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION problem

2008-04-11 Thread Nathan Nobbe
On Fri, Apr 11, 2008 at 6:30 AM, tedd [EMAIL PROTECTED] wrote:

 Isn't that what the code is doing?

 I'm dumping the results in a print_r($_SESSION) -- isn't that he same
 thing?


sorry tedd; obviously i was hasty to post.  but i figured just looking for
the obvious would be a good exercise as i cant count the times ive launched
into an exhaustive search for the problem when its really something silly
ive overlooked.  that said; i know ur smart and you always post hard
problems for 'the gang' ;)
anyway, taking the cue from some of the other responses, have you looked at
the page on session_write_close() ?
http://us2.php.net/manual/en/function.session-write-close.php
its kind of interesting; it looks like lots of people have run into issues
using the location header to redirect clients to another script after a form
submission.  its never happened to me (knock on wood) but anyway some of the
posts on that page may be worth reading.
also, though it wont answer your question about why its happening, i was
thinking you might alter the flow of ur scripts to see if you can get the
same behavior on both sites.  heres what i was thinking:
add a hidden input to the form (from index.php)

input type=hidden name=formsubmission value=1 /

then after you call session_start() in index.php, have the following

if(isset($_POST['formsubmission'])  $_POST['formsubmission'] == '1')) {
include('part2.php');  // process form submission
}

then, make the following adjustments to part2.php

remove the call to session_start()
remove the call to header(location ...
remove the call to exit()

i think this will have the effect that the work flow is unaltered, but the
organization of the logic on the back end will be different.  effectively
the call to header(location... will be removed so we would be able to tell
if the issue is related to that.

-nathan


Re: [PHP] $_SESSION problem [SOLVED (sort-of)]

2008-04-11 Thread Nathan Nobbe
top posting for the hell of it;
disregard last post; i didnt see the [solved] sort-of thread.

-nathan

On Fri, Apr 11, 2008 at 7:44 AM, tedd [EMAIL PROTECTED] wrote:

 At 10:12 PM -0400 4/10/08, Eric Wood wrote:

  tedd wrote:
 
  
   [1] http://www.webbytedd.com/x/index.php
   [2] http://sperling.com/x/index.php
  
   Both of these demos have the exact same code; and are on the same
   server; with exactly the same php-info -- so, why do they behave 
   differently
   re sessions?
  
 
  Strange.  I've run into issues whenever I use variable names which are
  the same as session variables.  It's as if they step on each others toes.  I
  try to use uniq var names.  I've also recently run into customized 401 pages
  (which you may not see happen, check the logs) start up and the session data
  gets overwrite due to a lack of session file locking.
  -eric
 


 -eric:

 You didn't provide the reason why, but you did provide a solution.

 Changing the variable names to be different than the session names fixed
 the problem.

 Now, if any php guru would care to tell me why, I would really like to
 know.

 Thanks eric.

 Cheers,

 tedd


 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $_SESSION problem

2008-04-10 Thread Nathan Nobbe
On Thu, Apr 10, 2008 at 4:29 PM, tedd [EMAIL PROTECTED] wrote:

 Hi gang:

 I'm stumped and in need of some expert explanation.

 I have prepared two demos (showing code) for your enjoyment:

 [1] http://www.webbytedd.com/x/index.php
 [2] http://sperling.com/x/index.php

 Both of these demos have the exact same code; and are on the same server;
 with exactly the same php-info -- so, why do they behave differently re
 sessions?

 Note that [1] will retain the session values throughout the entire
 session, while [2] does not and loses session values.


as a sanity check have you dumped out the contents of the session after
writing to it on [2] ?
eg.

?php
// 

 $_SESSION['q6'] = ( isset($_SESSION['q6']) ? $_SESSION['q6'] : 0);
$_SESSION['q7'] = ( isset($_SESSION['q7']) ? $_SESSION['q7'] : 0);
$_SESSION['q8'] = ( isset($_SESSION['q8']) ? $_SESSION['q8'] : 0);
$_SESSION['q9'] = ( isset($_SESSION['q9']) ? $_SESSION['q9'] : 0);
var_dump($_SESSION);
?

also, doubtful or id assume youd mention it; but do you have .htaccess on
either of the sites?  you might just dump out the session component of the
php config on each site to ensure theyre the same.

-nathan


Re: [PHP] $_SESSION problem

2008-04-10 Thread Nathan Nobbe
On Thu, Apr 10, 2008 at 5:05 PM, Nathan Nobbe [EMAIL PROTECTED]
wrote:

 On Thu, Apr 10, 2008 at 4:29 PM, tedd [EMAIL PROTECTED] wrote:
   you might just dump out the session component of the php config on each
 site to ensure theyre the same.


on that last note, this could be useful,

?php
die(var_dump(ini_get_all('session')));
?

-nathan


Re: [PHP] $_SESSION problem

2008-04-10 Thread Eric Wood

tedd wrote:


[1] http://www.webbytedd.com/x/index.php
[2] http://sperling.com/x/index.php

Both of these demos have the exact same code; and are on the same 
server; with exactly the same php-info -- so, why do they behave 
differently re sessions?


Strange.  I've run into issues whenever I use variable names which are 
the same as session variables.  It's as if they step on each others 
toes.  I try to use uniq var names.  I've also recently run into 
customized 401 pages (which you may not see happen, check the logs) 
start up and the session data gets overwrite due to a lack of session 
file locking. 


-eric

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION problem

2008-04-10 Thread paragasu
it looks fine to me. but i want to share one bad experience with sessions.
the code i wrote work just fine on my testing server (please note, the
phpinfo is same with
my production server).

after days of figuring out why the session do not work. finally, i found the
solutions.
the solutions is to add a

@session_write_close() on the end of the execution code. on my case it
happen
every time i forward the page. so adding the @session_write_close before the
header('location: ') fix the problem.

this might be a possible explanation..


Re: [PHP] $_SESSION problem

2008-04-10 Thread mike
I believe you can accomplish the same thing by just putting this in:

register_shutdown_function('session_write_close');



On 4/10/08, paragasu [EMAIL PROTECTED] wrote:
 it looks fine to me. but i want to share one bad experience with sessions.
 the code i wrote work just fine on my testing server (please note, the
 phpinfo is same with
 my production server).

 after days of figuring out why the session do not work. finally, i found the
 solutions.
 the solutions is to add a

 @session_write_close() on the end of the execution code. on my case it
 happen
 every time i forward the page. so adding the @session_write_close before the
 header('location: ') fix the problem.

 this might be a possible explanation..


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-18 Thread Nuno Vaz Oliveira

Roman:
[...]
You don't need to know your IP. See the grammar for AbsoluteURI:
ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt


I'm asking this because my IP is dynamic and I'm using a free
redirection
service. My site is at 'http://something.no-ip.org/sitename' can I
use
'http://something.no-ip.org/sitename/index.php?vaz=value' on the
Locarion header?

Actually you *must* use it instead of just the index... part.



Thank you Roman, I'm now working with absolute paths! :)

I Never thought that HTML had those specs...
With the relative link it worked and so it was OK for me...

Bye

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-18 Thread pub


On Jan 18, 2007, at 12:59 AM, Nuno Vaz Oliveira wrote:


Roman:
[...]
You don't need to know your IP. See the grammar for AbsoluteURI:
ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt

I'm asking this because my IP is dynamic and I'm using a free
redirection
service. My site is at 'http://something.no-ip.org/sitename' can I
use
'http://something.no-ip.org/sitename/index.php?vaz=value' on the
Locarion header?

Actually you *must* use it instead of just the index... part.


Thank you Roman, I'm now working with absolute paths! :)

I Never thought that HTML had those specs...
With the relative link it worked and so it was OK for me...

Bye

--
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: [PHP] $_SESSION variable gets lost on FORM action

2007-01-18 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-18 08:59:11 +:
 Roman:
 [...]
 You don't need to know your IP. See the grammar for AbsoluteURI:
 ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt
 
 I'm asking this because my IP is dynamic and I'm using a free
 redirection service. My site is at
 'http://something.no-ip.org/sitename' can I use
 'http://something.no-ip.org/sitename/index.php?vaz=value' on the
 Locarion header?
 Actually you *must* use it instead of just the index... part.
 
 
 Thank you Roman, I'm now working with absolute paths! :)
 
 I Never thought that HTML had those specs...

It's not HTML, that's a completely different animal! HTTP is a transport
protocol, HTML is a document format.  HTML documents are but one type
of things you can transport using HTTP.

 With the relative link it worked and so it was OK for me...

Don't rely on browser bugs and features present to work around popular
bugs in server-side scripts.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-18 Thread Nuno Vaz Oliveira

From Roman:


Roman:
[...]
You don't need to know your IP. See the grammar for AbsoluteURI:
ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt

I'm asking this because my IP is dynamic and I'm using a free
redirection service. My site is at
'http://something.no-ip.org/sitename' can I use
'http://something.no-ip.org/sitename/index.php?vaz=value' on the
Locarion header?


Actually you *must* use it instead of just the index... part.


Thank you Roman, I'm now working with absolute paths! :)

I Never thought that HTML had those specs...


It's not HTML, that's a completely different animal! HTTP is a
transport
protocol, HTML is a document format.  HTML documents are but one type
of things you can transport using HTTP.

With the relative link it worked and so it was OK for me...


Don't rely on browser bugs and features present to work around popular
bugs in server-side scripts.



Sorry, that was my BUG!!

Your totally right and I know that. I was with my head at some other place
when I wrote that (probably).

I don't know that much of HTTP (or other protocols) but my knowladge
of (X)HTML (used by its semantic) is very good. Also, I use headers to
send files, images and document types and that's got nothing to do
with HTML.

Glad that you reminded me, thanks,
Nuno

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-17 Thread Nuno Oliveira

Stut wrote:


Redirecting using a Location header is not the only thing you can do 
with the header() function. It will never end processing of the script 
no matter what you pass to it. The example on the manual page for the 
header() function says as much (http://php.net/header), you read that 
right?


?php
header(Location: http://www.example.com/;); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?

-Stut



Well, I feel like a du***ss!

No, I hadn't read that. I promisse, and this one is to keep, I won't 
post to this list again without dedicate enough time to the problem, at 
least to read the manual.


Anyway, thank you for confirm what I should have known in advance and 
also for remembering me that PHP developers have a PHP manual for PHP 
users...


Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-17 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-17 19:06:16 +:
 Stut wrote:
 Redirecting using a Location header is not the only thing you can do 
 with the header() function. It will never end processing of the script 
 no matter what you pass to it. The example on the manual page for the 
 header() function says as much (http://php.net/header), you read that 
 right?
 
 Well, I feel like a du***ss!
 
 No, I hadn't read that. I promisse, and this one is to keep, I won't 
 post to this list again without dedicate enough time to the problem, at 
 least to read the manual.
 
 Anyway, thank you for confirm what I should have known in advance and 
 also for remembering me that PHP developers have a PHP manual for PHP 
 users...

Also, the header() call you provided in the original post was a
violation of HTTP. Knowing the programming language is just one of
your responsibilities IMNSHO.  The manual for HTTP users (you!) is at
ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-17 Thread Nuno Vaz Oliveira

Roman wrote:
# [EMAIL PROTECTED] / 2007-01-17 19:06:16 +:


Stut wrote:


Redirecting using a Location header is not the only thing you can do
with the header() function. It will never end processing of the
script no matter what you pass to it. The example on the manual page
for the header() function says as much (http://php.net/header), you
read that right?


Well, I feel like a du***ss!

No, I hadn't read that. I promisse, and this one is to keep, I won't
post to this list again without dedicate enough time to the problem,
at least to read the manual.

Anyway, thank you for confirm what I should have known in advance and
also for remembering me that PHP developers have a PHP manual for PHP
users...


Also, the header() call you provided in the original post was a
violation of HTTP. Knowing the programming language is just one of
your responsibilities IMNSHO.  The manual for HTTP users (you!) is at
ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt



Hi Roman,

My English is not the best and I'm not sure what you mean. By looking at
the document you linked I'm thinking that the problem you're talking about
is not the '?var=value' but instead, the fact of being using a relative URL.

Am I correct?

If so, is there a way to know the full address of the index.php file?
I'm asking this because my IP is dynamic and I'm using a free redirection
service. My site is at 'http://something.no-ip.org/sitename' can I use
'http://something.no-ip.org/sitename/index.php?vaz=value' on the
Locarion header?

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-17 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-18 00:06:27 +:
 Roman wrote:
 Also, the header() call you provided in the original post was a
 violation of HTTP. Knowing the programming language is just one of
 your responsibilities IMNSHO.  The manual for HTTP users (you!) is at
 ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt
 
 My English is not the best and I'm not sure what you mean. By looking at
 the document you linked I'm thinking that the problem you're talking about
 is not the '?var=value' but instead, the fact of being using a relative URL.
 
 Am I correct?
 
Yes.

 If so, is there a way to know the full address of the index.php file?

You don't need to know your IP. See the grammar for AbsoluteURI:
ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt

 I'm asking this because my IP is dynamic and I'm using a free redirection
 service. My site is at 'http://something.no-ip.org/sitename' can I use
 'http://something.no-ip.org/sitename/index.php?vaz=value' on the
 Locarion header?

Actually you *must* use it instead of just the index... part.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-16 Thread David Giragosian

On 1/16/07, Nuno Oliveira [EMAIL PROTECTED] wrote:


Hi,

I'm working on a website and one of the features that I've implemented
so far is the user timeout.

Every time that a user browses to a different page, the variable named
$_SESSION['user']['lastactive'] is updated to the current time.

However, before that, my PHP scripts check if the session for this user
had timed out or not...

The script that checks that is named session.php and it is included in
every file. If it detects a timeout, it sets a variable
$_SESSION['form']['errors'] to a string ('Your session has expired...
Bla, bla, bla...') and then redirects to the login.php and the user will
see that he his being asked to login again for the reason displayed.

Everything works great except in one situation... If the timeout period
happens when the user is filling a form, the action that it executes
(process.php) will also include session.php and it sets the error string
but when it redirects to login.php the $_SESSION['form']['errors']
variable is empty...



You must be unsetting the individual $_SESSION['form']['errors']  variable
or the entire $_SESSION array somewhere in there.

David


Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-16 Thread Nuno Oliveira

David Giragosian wrote:

On 1/16/07, Nuno Oliveira [EMAIL PROTECTED] wrote:


Hi,

I'm working on a website and one of the features that I've implemented
so far is the user timeout.

Every time that a user browses to a different page, the variable named
$_SESSION['user']['lastactive'] is updated to the current time.

However, before that, my PHP scripts check if the session for this user
had timed out or not...

The script that checks that is named session.php and it is included in
every file. If it detects a timeout, it sets a variable
$_SESSION['form']['errors'] to a string ('Your session has expired...
Bla, bla, bla...') and then redirects to the login.php and the user will
see that he his being asked to login again for the reason displayed.

Everything works great except in one situation... If the timeout period
happens when the user is filling a form, the action that it executes
(process.php) will also include session.php and it sets the error string
but when it redirects to login.php the $_SESSION['form']['errors']
variable is empty...



You must be unsetting the individual $_SESSION['form']['errors']  variable
or the entire $_SESSION array somewhere in there.

David



Hi Davis, thanks for the reply.

I think that I've found the problem... But if you (or anyone else) can 
confirm I would appreciate.


Sometimes in my code I use the Header('Location: index.php?var=value'); 
and I've found out (I think) that when one of these headers are executed 
by PHP, the rest of the script gets executed.



I'm thinking that this is the problem because I've eliminated all the 
occurrences where the SESSION var was cleared until only one exists and 
it was after a Location Header.


I've put an exit(); after the header and the problem was gone... :)

Is this the correct PHP/HTML behavior or is there another problem? Am I 
supposed to put an exit(); after a header Location to make sure that 
no more code gets executed?


Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION variable gets lost on FORM action

2007-01-16 Thread Stut

Nuno Oliveira wrote:
Sometimes in my code I use the Header('Location: index.php?var=value'); 
and I've found out (I think) that when one of these headers are executed 
by PHP, the rest of the script gets executed.


I'm thinking that this is the problem because I've eliminated all the 
occurrences where the SESSION var was cleared until only one exists and 
it was after a Location Header.


I've put an exit(); after the header and the problem was gone... :)

Is this the correct PHP/HTML behavior or is there another problem? Am I 
supposed to put an exit(); after a header Location to make sure that 
no more code gets executed?


Redirecting using a Location header is not the only thing you can do 
with the header() function. It will never end processing of the script 
no matter what you pass to it. The example on the manual page for the 
header() function says as much (http://php.net/header), you read that right?


?php
header(Location: http://www.example.com/;); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-25 Thread Jochem Maas

Daevid Vincent wrote:

No no no. I'm NOT passing data between servers. It's just two pages on the
same server. One that sets up the session/class and the other page just
re-loads the session. 


When I talk about two different servers, I copy the entire source/db schema
from one server to the other so they are clones for all intents and
purposes.

One server works the way I'd expect.
The other doesn't.
SAME code on both. Same schema. Nearly identical LAMP versions.


keyword is 'Nearly' - please take into account that the behaviour
of php can change from version to version (sometimes the change is
completely unintentional and unwanted.):


[EMAIL PROTECTED]:/lockdown# php --version
PHP 5.0.3 (cli) (built: Jan  5 2006 13:18:18)


PHP5.0.3


Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend
Technologies
with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend
Technologies


the not working box doesn't run the Zend stuff - try turning it
off to see if that break your working machine (doubtful)



NOT WORKING BOX:
vmware apache2-php5 # php --version
PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04)


PHP5.0.5 (or even PHP5.0.5-pl3-gentoo what exotic flavor that might be)


given that the not working box is running php5.0.5 and the working box
a prior version gives me the sneaking suspicion (spelling!?) that
you may be looking at a reference related problem.

I assume your php CLI is from the same build as the apache module (or
whatever sapi your websaerver uses), correct? (otherwise you'll need
to look at the version info in phpinfo() as viewed via your webbrowser)


Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies
This is why I'm saying, it's not my PHP code or database or anything like
that.
It must be some kind of server configuration, but I can't figure out what it
would be. I've compared the php.ini files and don't see anything that seems
relevant. 


the session is not set to auto start on the not working server per chance?






-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 24, 2006 4:54 PM

To: php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] $_SESSION saves all values but Class -- 
works on one server but not another?! [second plead for help]


You say it's working on one box and not on the other?  Maybe 
I'm wrong (and sounds like I am) but I thought that you 
couldn't pass objects between scripts even with serialize()?


Certainly sounds like it was working for you...   can anyone 
clarify what objects/variables/data types can be passed from 
script to script and what can't?


tg, try the manual.



I know things like database connections can't be shared (that 
is, you can't assign a MySQL connect link to a variable then 
pass that variable/connect to the next script, it needs to 
reconnect the next time around.. or am I wrong about that too? hah)


-TG
God I'm tired

= = = Original message = = =

Thought I'd give this another shot since I still can't figure 
it out after

nearly a week...

I have a gentoo server that doesn't save/restore the CLASS 
portion of a
session, but it does retain other $_SESSION values. This code 
works fine on

a debian box.

WORKING BOX:
[snip]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread tg-php
You say it's working on one box and not on the other?  Maybe I'm wrong (and 
sounds like I am) but I thought that you couldn't pass objects between scripts 
even with serialize()?

Certainly sounds like it was working for you...   can anyone clarify what 
objects/variables/data types can be passed from script to script and what can't?

I know things like database connections can't be shared (that is, you can't 
assign a MySQL connect link to a variable then pass that variable/connect to 
the next script, it needs to reconnect the next time around.. or am I wrong 
about that too? hah)

-TG
God I'm tired

= = = Original message = = =

Thought I'd give this another shot since I still can't figure it out after
nearly a week...

I have a gentoo server that doesn't save/restore the CLASS portion of a
session, but it does retain other $_SESSION values. This code works fine on
a debian box.

WORKING BOX:
[snip]

___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread Daevid Vincent
No no no. I'm NOT passing data between servers. It's just two pages on the
same server. One that sets up the session/class and the other page just
re-loads the session. 

When I talk about two different servers, I copy the entire source/db schema
from one server to the other so they are clones for all intents and
purposes.

One server works the way I'd expect.
The other doesn't.
SAME code on both. Same schema. Nearly identical LAMP versions.
This is why I'm saying, it's not my PHP code or database or anything like
that.
It must be some kind of server configuration, but I can't figure out what it
would be. I've compared the php.ini files and don't see anything that seems
relevant. 


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 24, 2006 4:54 PM
 To: php-general@lists.php.net
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSION saves all values but Class -- 
 works on one server but not another?! [second plead for help]
 
 You say it's working on one box and not on the other?  Maybe 
 I'm wrong (and sounds like I am) but I thought that you 
 couldn't pass objects between scripts even with serialize()?
 
 Certainly sounds like it was working for you...   can anyone 
 clarify what objects/variables/data types can be passed from 
 script to script and what can't?
 
 I know things like database connections can't be shared (that 
 is, you can't assign a MySQL connect link to a variable then 
 pass that variable/connect to the next script, it needs to 
 reconnect the next time around.. or am I wrong about that too? hah)
 
 -TG
 God I'm tired
 
 = = = Original message = = =
 
 Thought I'd give this another shot since I still can't figure 
 it out after
 nearly a week...
 
 I have a gentoo server that doesn't save/restore the CLASS 
 portion of a
 session, but it does retain other $_SESSION values. This code 
 works fine on
 a debian box.
 
 WORKING BOX:
 [snip]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!

2006-01-19 Thread Daevid Vincent
Thank you for the reply. I don't think that's the issue.

I have:

; Initialize session on request startup.
session.auto_start = 0

But this is the same setting as the box that DOES work.

What's really confusing me is that part of the SESSION does work. I would
expect an all or nothing case. Everything but the class is restored.

You had me at EHLO --E.Webb (10.04.05)  

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 19, 2006 1:54 PM
 To: Daevid Vincent
 Subject: Re: [PHP] $_SESSION saves all values but Class -- 
 works on one server but not another?!
 
 On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote:
  I have a gentoo server that doesn't save/restore the CLASS 
 portion of
  a
  session, but it does retain other $_SESSION values. This code works
 
 Sounds to me like the Gentoo box does not have 'autoload' so the
 objects coming back out of the session have no 'class' to build
 themselves from...
 
 I confess to not reading all the details you posted to see if autoload
 was on/off differently in the two...
 
 Especially since I have no idea how to turn it on/off as I 
 never used it.
 
 -- 
 Like Music?
 http://l-i-e.com/artists.htm
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!

2006-01-19 Thread Richard Lynch


Object 'autoload' has absolutely NOTHING to do with session.auto_start.

http://www.php.net/autoload

On Thu, January 19, 2006 4:10 pm, Daevid Vincent wrote:
 Thank you for the reply. I don't think that's the issue.

 I have:

 ; Initialize session on request startup.
 session.auto_start = 0

 But this is the same setting as the box that DOES work.

 What's really confusing me is that part of the SESSION does work. I
 would
 expect an all or nothing case. Everything but the class is restored.

 You had me at EHLO --E.Webb (10.04.05)

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Thursday, January 19, 2006 1:54 PM
 To: Daevid Vincent
 Subject: Re: [PHP] $_SESSION saves all values but Class --
 works on one server but not another?!

 On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote:
  I have a gentoo server that doesn't save/restore the CLASS
 portion of
  a
  session, but it does retain other $_SESSION values. This code
 works

 Sounds to me like the Gentoo box does not have 'autoload' so the
 objects coming back out of the session have no 'class' to build
 themselves from...

 I confess to not reading all the details you posted to see if
 autoload
 was on/off differently in the two...

 Especially since I have no idea how to turn it on/off as I
 never used it.

 --
 Like Music?
 http://l-i-e.com/artists.htm




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!

2006-01-19 Thread Daevid Vincent
You are correct, however that also seems to have to do with the actual class
or php code and not a server configuration. If I copy my PHP files to the
'other' server, everything works as expected -- no change in code required.
This is why I suspect it is a PHP/Apache/php.ini type of problem. But as I
tried to illustrate, the php.ini seems to be nearly the same on both
servers. 

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 19, 2006 2:46 PM
 To: Daevid Vincent
 Cc: php-general@lists.php.net; [EMAIL PROTECTED]
 Subject: RE: [PHP] $_SESSION saves all values but Class -- 
 works on one server but not another?!
 
 
 
 Object 'autoload' has absolutely NOTHING to do with 
 session.auto_start.
 
 http://www.php.net/autoload
 
 On Thu, January 19, 2006 4:10 pm, Daevid Vincent wrote:
  Thank you for the reply. I don't think that's the issue.
 
  I have:
 
  ; Initialize session on request startup.
  session.auto_start = 0
 
  But this is the same setting as the box that DOES work.
 
  What's really confusing me is that part of the SESSION does work. I
  would
  expect an all or nothing case. Everything but the class is restored.
 
  You had me at EHLO --E.Webb (10.04.05)
 
  -Original Message-
  From: Richard Lynch [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 19, 2006 1:54 PM
  To: Daevid Vincent
  Subject: Re: [PHP] $_SESSION saves all values but Class --
  works on one server but not another?!
 
  On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote:
   I have a gentoo server that doesn't save/restore the CLASS
  portion of
   a
   session, but it does retain other $_SESSION values. This code
  works
 
  Sounds to me like the Gentoo box does not have 'autoload' so the
  objects coming back out of the session have no 'class' to build
  themselves from...
 
  I confess to not reading all the details you posted to see if
  autoload
  was on/off differently in the two...
 
  Especially since I have no idea how to turn it on/off as I
  never used it.
 
  --
  Like Music?
  http://l-i-e.com/artists.htm
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -- 
 Like Music?
 http://l-i-e.com/artists.htm
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION and header()

2005-06-30 Thread Richard Lynch
On Sun, June 26, 2005 7:33 am, Alessandro Rosa said:
 (a) : After saving a couple of data into two $_SESSION variables from a
 form,
 (b) : I used the header() function to redirect the browser to
 (c) : display another page.

(c) needs ?php session_start();? at the top, just like (a) and (b) and
(z) for any other page you want to use your session data.

Also, *WHY* redirect the browser and chew up an HTTP connection and make
your application twice as slow?

Plus, with the session_start() in there, you're going to duplicate all the
effort you've already gone to to build up the session data structure
(overhead).

At that point in your script, you could just include (c) and be done
with it.

It's a heck of a lot easier to debug without feeling like you're the
pinball in a fast-paced game of HTTP redirects, imho.

You also make life easier on cURL and other programmatic access of your
site, if you don't force them to play follow the bouncing ball to track
down what they asked for.  Just give it to them already. :-)

I played with header(Location: ) in my early PHP days, and stopped using
it rather quickly, unless I actually have a URL I want to maintain for the
search engines for awhile, but the document has actually moved.

Just because the re-direct works doesn't make it the best answer.

Others on this list just LOVE to have a bunch of header(Location: )
statements in their PHP code, so you are not alone.

Just something to think about. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION and header()

2005-06-26 Thread Paul Waring
On Sun, Jun 26, 2005 at 04:33:30PM +0200, Alessandro Rosa wrote:
 But, when I'm in the new page of (c), the $_SESSION variables stored
 in (a) are no longer available and I can get anymore their values then,
 (I can't say if they have been unset or erased).

You have to pass the session ID between pages, either by setting
session.use_cookies = 1 (so that the session ID is passed using a
cookie where possible) or append the session ID to the URL you are
redirecting to as part of the query parameters.

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION and header()

2005-06-26 Thread Alessandro Rosa
Does (c) have at the top of its page:
?php session_start(); ?

André


 You have to pass the session ID between pages, either by setting
 session.use_cookies = 1 (so that the session ID is passed using a
 cookie where possible) or append the session ID to the URL you are
 redirecting to as part of the query parameters.

Paul


Thank you both!
I did always use session_start() and finally I also already use
the second option Paul addressed, in order to overcome the
issues raised by header(). Not in the same terms, but the URL
parameters was my idea too.

So could I guess that this is there's no direct remedy to
avoid header() delete sessions variables?:-)

Alessandro

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION - Learning

2004-05-10 Thread apur kurub ver.1
there must be
session_start() before your code
have you check the $row-user, is it have value??

rgds
[xm]
http://amadarum.e-tics.net/nigritude-ultramarine.php

- Original Message - 
From: Ross Bateman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 10, 2004 12:24 PM
Subject: [PHP] $_SESSION - Learning


 Hi

 I am finally starting to try and use register_globals = off on my Servers.
 This means a lot of code that has to be checked and changed.

 Unfortunatly I am struggeling to come to grips with this new concept (new
to
 me that is) and was wondering if anybody could give me some pointers.

 Getting stumped at my login script.
 Once I have checked user and passwords, I pass a few SESSION vars to use
 throughout my app.

 snip
 if ($status == 1)
{
//initiate a session
session_start();
//register session variables
$_SESSION['SESSION'];
//Get DataBase details and connect to it
include($root_path . include/vars.php);
$query = SELECT * FROM admin WHERE user_name = '$user';
$result = mysql_query($query);
$row = mysql_fetch_object($result);
//include the username
$_SESSION['SESSION_UNAME'] = $row-user;
//include the user id
$_SESSION['SESSION_UID'] = $row-admin_id;
//set the SecLevel Session Var
$_SESSION['SESSION_SEC'] = $row-sec_level;
//Now do the redirect
//redirect to Admin Page
header(Location: ./admin_main.php);
exit();

}
 else
 /snip

 Where ever I have the $SESSION['var_name'] I used to have a
 session_register(SESSION_VAR);
 $SESSION_VAR = $row-user;

 I then redirect to my app main page and check if a session is registerd to
 make sure a user is logged in:

 //check that each page is secure
 session_start();
 //OLD CODE IN SCRIPT = if (!session_is_registered(SESSION))
 if(isset($_SESSION['SESSION']))
{
//if session check fails, invoke error handler
header(Location: ./../error.php?e=2);
exit();
}
 ?

 That all works fine, but when I finaly start to display data on the main
 page, nothing shows up.

 One of the things I try to display is the name of the user logged in:
 From the login script
 //include the username
 $_SESSION['SESSION_UNAME'] = $row-user;

 then on my main page
 echo logged in as b . $_SESSION['SESSION_UNAME'] . /b ;

 Needless to say, no data is displayed. anybody able to point out what
I
 am getting wrong here. It used to work fine before the old way with
 register_globals = on.

 SIDE Note:
 On a Windows PC with Apache, PHP and MySQL installed, even with the
 register_globals = on set, the SESSION vars do not work.

 Thanks and sorry for the long post,

 Ross

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION vs Database Call

2004-03-25 Thread Vail, Warren
The difference between the two probably works out to less than 10
milliseconds on most servers, from a quick study that I ran on some HP
servers that were brand new last summer, with the faster times using the
filesystem.  Course, the flexibility gained in managing the database version
caused us to ask, would any of our users notice a 10 millisecond difference
in response?  Answer was; only the paranoid would notice the difference ;-).
Course our user population was relatively small (100 - 500 concurrently
signed on).

Warren Vail


-Original Message-
From: Chris Thomas [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 3:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] $_SESSION vs Database Call


Just wondering, what is faster / more effecient,  storing a value in the
session variable which gets stored on the filesystem (from what i
understand) or database calls to re-get the information?

Chris

-- 
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: [PHP] $_SESSION vs Database Call

2004-03-25 Thread Chris W. Parker
Vail, Warren mailto:[EMAIL PROTECTED]
on Thursday, March 25, 2004 4:40 PM said:

 Answer was; only the paranoid
 would notice the difference ;-). Course our user population was
 relatively small (100 - 500 concurrently signed on).

i don't even think rainman would notice 10 milliseconds.


chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION

2004-01-20 Thread Aaron Wolski
You need to call session_start() on each page.

 -Original Message-
 From: Alex Hogan [mailto:[EMAIL PROTECTED]
 Sent: January 20, 2004 1:29 PM
 To: PHP General list
 Subject: [PHP] $_SESSION
 
 I've got a question that I'm sure has a simple answer.
 
 
 
 Why aren't my session objects transferring across more than one page?
 
 
 
 I'm calling a session object that was set in the page prior;
 
 $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];
 
 
 
 I then assign a variable that value;
 
 $myvar = $_SESSION['mysessionvar'];
 
 
 
 echo $myvar;
 
 
 
 This displays like I expected.  However when I go to the next page and
 want
 to display this var again I get either an Undefined index or variable.
 According to the docs $_SESSION[] is now global and this is the way of
 setting and retrieving session objects, right?
 
 
 
 I have tried calling that session object again but it's empty and so
is
 the
 variable.  I thought that the session would stay open until I close
the
 browser and I could return those values any time I wanted.  Am I
missing
 something?
 
 
 
 
 
 
 
 alex hogan
 
 
 
 
 
 **
 The contents of this e-mail and any files transmitted with it are
 confidential and intended solely for the use of the individual or
 entity to whom it is addressed.  The views stated herein do not
 necessarily represent the view of the company.  If you are not the
 intended recipient of this e-mail you may not copy, forward,
 disclose, or otherwise use it or any part of it in any form
 whatsoever.  If you have received this e-mail in error please
 e-mail the sender.
 **
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION

2004-01-20 Thread Alex Hogan

Yeah..., I tried that.

I got back an error that read;
Warning: session_start(): Cannot send session cookie - headers already sent
by
Warning: session_start(): Cannot send session cache limiter - headers
already sent.




 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, January 20, 2004 12:31 PM
 To: 'Alex Hogan'; 'PHP General list'
 Subject: RE: [PHP] $_SESSION
 
 You need to call session_start() on each page.
 
  -Original Message-
  From: Alex Hogan [mailto:[EMAIL PROTECTED]
  Sent: January 20, 2004 1:29 PM
  To: PHP General list
  Subject: [PHP] $_SESSION
 
  I've got a question that I'm sure has a simple answer.
 
 
 
  Why aren't my session objects transferring across more than one page?
 
 
 
  I'm calling a session object that was set in the page prior;
 
  $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];
 
 
 
  I then assign a variable that value;
 
  $myvar = $_SESSION['mysessionvar'];
 
 
 
  echo $myvar;
 
 
 
  This displays like I expected.  However when I go to the next page and
  want
  to display this var again I get either an Undefined index or variable.
  According to the docs $_SESSION[] is now global and this is the way of
  setting and retrieving session objects, right?
 
 
 
  I have tried calling that session object again but it's empty and so
 is
  the
  variable.  I thought that the session would stay open until I close
 the
  browser and I could return those values any time I wanted.  Am I
 missing
  something?
 
 
 
 
 
 
 
  alex hogan
 
 
 
 
 
  **
  The contents of this e-mail and any files transmitted with it are
  confidential and intended solely for the use of the individual or
  entity to whom it is addressed.  The views stated herein do not
  necessarily represent the view of the company.  If you are not the
  intended recipient of this e-mail you may not copy, forward,
  disclose, or otherwise use it or any part of it in any form
  whatsoever.  If you have received this e-mail in error please
  e-mail the sender.
  **
 



** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




RE: [PHP] $_SESSION

2004-01-20 Thread Aaron Wolski
You have to put it at the top of the page prior to anything else.

?php

session_start();

//proceed with other code

?

 -Original Message-
 From: Alex Hogan [mailto:[EMAIL PROTECTED]
 Sent: January 20, 2004 1:45 PM
 To: 'PHP General list'
 Subject: RE: [PHP] $_SESSION
 
 
 Yeah..., I tried that.
 
 I got back an error that read;
 Warning: session_start(): Cannot send session cookie - headers already
 sent
 by
 Warning: session_start(): Cannot send session cache limiter - headers
 already sent.
 
 
 
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, January 20, 2004 12:31 PM
  To: 'Alex Hogan'; 'PHP General list'
  Subject: RE: [PHP] $_SESSION
 
  You need to call session_start() on each page.
 
   -Original Message-
   From: Alex Hogan [mailto:[EMAIL PROTECTED]
   Sent: January 20, 2004 1:29 PM
   To: PHP General list
   Subject: [PHP] $_SESSION
  
   I've got a question that I'm sure has a simple answer.
  
  
  
   Why aren't my session objects transferring across more than one
page?
  
  
  
   I'm calling a session object that was set in the page prior;
  
   $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];
  
  
  
   I then assign a variable that value;
  
   $myvar = $_SESSION['mysessionvar'];
  
  
  
   echo $myvar;
  
  
  
   This displays like I expected.  However when I go to the next page
and
   want
   to display this var again I get either an Undefined index or
variable.
   According to the docs $_SESSION[] is now global and this is the
way of
   setting and retrieving session objects, right?
  
  
  
   I have tried calling that session object again but it's empty and
so
  is
   the
   variable.  I thought that the session would stay open until I
close
  the
   browser and I could return those values any time I wanted.  Am I
  missing
   something?
  
  
  
  
  
  
  
   alex hogan
  
  
  
  
  
   **
   The contents of this e-mail and any files transmitted with it are
   confidential and intended solely for the use of the individual or
   entity to whom it is addressed.  The views stated herein do not
   necessarily represent the view of the company.  If you are not the
   intended recipient of this e-mail you may not copy, forward,
   disclose, or otherwise use it or any part of it in any form
   whatsoever.  If you have received this e-mail in error please
   e-mail the sender.
   **
  
 
 
 
 **
 The contents of this e-mail and any files transmitted with it are
 confidential and intended solely for the use of the individual or
 entity to whom it is addressed.  The views stated herein do not
 necessarily represent the view of the company.  If you are not the
 intended recipient of this e-mail you may not copy, forward,
 disclose, or otherwise use it or any part of it in any form
 whatsoever.  If you have received this e-mail in error please
 e-mail the sender.
 **
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION

2004-01-20 Thread Ben Ramsey
Alex Hogan wrote:
I got back an error that read;
Warning: session_start(): Cannot send session cookie - headers already sent
by
Warning: session_start(): Cannot send session cache limiter - headers
already sent.
You need to use session_start() before any headers are written.
-Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] $_SESSION

2004-01-20 Thread Alex Hogan
Oopps, my bad. sorry.

That worked like a champ...

Thanks...,

I'll sulk off now...

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, January 20, 2004 12:46 PM
 To: 'Alex Hogan'; 'PHP General list'
 Subject: RE: [PHP] $_SESSION
 
 You have to put it at the top of the page prior to anything else.
 
 ?php
 
   session_start();
 
   //proceed with other code
 
 ?
 
  -Original Message-
  From: Alex Hogan [mailto:[EMAIL PROTECTED]
  Sent: January 20, 2004 1:45 PM
  To: 'PHP General list'
  Subject: RE: [PHP] $_SESSION
 
 
  Yeah..., I tried that.
 
  I got back an error that read;
  Warning: session_start(): Cannot send session cookie - headers already
  sent
  by
  Warning: session_start(): Cannot send session cache limiter - headers
  already sent.
 
 
 
 
   -Original Message-
   From: Aaron Wolski [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, January 20, 2004 12:31 PM
   To: 'Alex Hogan'; 'PHP General list'
   Subject: RE: [PHP] $_SESSION
  
   You need to call session_start() on each page.
  
-Original Message-
From: Alex Hogan [mailto:[EMAIL PROTECTED]
Sent: January 20, 2004 1:29 PM
To: PHP General list
Subject: [PHP] $_SESSION
   
I've got a question that I'm sure has a simple answer.
   
   
   
Why aren't my session objects transferring across more than one
 page?
   
   
   
I'm calling a session object that was set in the page prior;
   
$_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];
   
   
   
I then assign a variable that value;
   
$myvar = $_SESSION['mysessionvar'];
   
   
   
echo $myvar;
   
   
   
This displays like I expected.  However when I go to the next page
 and
want
to display this var again I get either an Undefined index or
 variable.
According to the docs $_SESSION[] is now global and this is the
 way of
setting and retrieving session objects, right?
   
   
   
I have tried calling that session object again but it's empty and
 so
   is
the
variable.  I thought that the session would stay open until I
 close
   the
browser and I could return those values any time I wanted.  Am I
   missing
something?
   
   
   
   
   
   
   
alex hogan
   
   
   
   
   
**
The contents of this e-mail and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity to whom it is addressed.  The views stated herein do not
necessarily represent the view of the company.  If you are not the
intended recipient of this e-mail you may not copy, forward,
disclose, or otherwise use it or any part of it in any form
whatsoever.  If you have received this e-mail in error please
e-mail the sender.
**
   
 
 
 
  **
  The contents of this e-mail and any files transmitted with it are
  confidential and intended solely for the use of the individual or
  entity to whom it is addressed.  The views stated herein do not
  necessarily represent the view of the company.  If you are not the
  intended recipient of this e-mail you may not copy, forward,
  disclose, or otherwise use it or any part of it in any form
  whatsoever.  If you have received this e-mail in error please
  e-mail the sender.
  **
 



** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




RE: [PHP] $_SESSION

2004-01-20 Thread Ryan A
Hey,
Make sure its right on top of the pagejust at the start of your ?php
before even calling a include or require etc

HTH.

-Ryan

On 1/20/2004 7:44:31 PM, [EMAIL PROTECTED] wrote:
 Yeah..., I tried that.
 
 I got back an error that read;
 Warning: session_start(): Cannot send session cookie - headers already
 sent
 by
 Warning: session_start(): Cannot send session cache limiter - headers
 already sent.
 
 
 
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, January 20, 2004 12:31 PM
  To: 'Alex Hogan'; 'PHP General list'
  Subject: RE: [PHP] $_SESSION
 
  You need to call session_start() on each page.
 
   -Original Message-
   From: Alex Hogan [mailto:[EMAIL PROTECTED]
   Sent: January 20, 2004 1:29 PM
   To: PHP General list
   Subject: [PHP] $_SESSION
  
   I've got a question that I'm sure has a simple answer.
  
  
  
   Why
 aren't my session objects transferring across more than one page?
  
  
  
   I'm
 calling a session object that was set in the page prior;
  
   $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];
  
  
  
   I then assign a variable that value;
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION

2004-01-20 Thread John Nichel
Alex Hogan wrote:

I've got a question that I'm sure has a simple answer.

Why aren't my session objects transferring across more than one page?

I'm calling a session object that was set in the page prior;

$_SESSION['mysessionvar'] = $_REQUEST['mytxtobj'];

I then assign a variable that value;

$myvar = $_SESSION['mysessionvar'];

echo $myvar;

This displays like I expected.  However when I go to the next page and want
to display this var again I get either an Undefined index or variable.
According to the docs $_SESSION[] is now global and this is the way of
setting and retrieving session objects, right?
I have tried calling that session object again but it's empty and so is the
variable.  I thought that the session would stay open until I close the
browser and I could return those values any time I wanted.  Am I missing
something?
Are you starting the session on each page?

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP $_SESSION Expiring in IE

2004-01-03 Thread Al
IE and Moz have different JAVA script engines.  Try turning off JAVA and 
see if IE maintains it's session. 

Tarrant Costelloe wrote:

Hello,

I have recently launched the new Planet-Tolkien.com, one would think
that writing a message board from scratch and a dynamic weather system,
a simple session login would be the least of my problems right? Wrong.
It would appear that for Mozilla and Opera keep a $_SESSION is not an
issue and the $_SESSION is continued until the member logs out. However
when members are using Internet Explorer browser (most versions it
seems), they can go around the site for varied amounts of time, usually
less than five minutes and then their $_SESSION will expire!!??
I cannot for the life of me figure out why a server side $_SESSION would
expire on IE but not for MOZ or Opera but it is, and I need to figure
out why and how can I fix this.
REF. All login information is saved as such:

session_save_path($path/sessions); 
session_start(); $_SESSION['session_memberID']=$session_memberID;
$_SESSION['session_username']=$session_username;
$_SESSION['session_groupID']=$membergroup;

In Fellowship,
Tarrant 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_SESSION var sometimes set, sometimes not

2003-11-24 Thread John W. Holmes
Anthony Whipple wrote:

The following code sometimes produces output indicating that the session
variables have been set, and sometimes is says that they have not been set.
Unfortunately the server is not mine to configure, but if there is a problem
with it, I can get in touch with the right people.  Is the script properly
written?  Is it a server problem?
html
head
 titleTest stuff.../title
/head
body
?php
session_start(); // enable session level global variables
This shouldn't work at all. You need to have session_start() before any 
HTML or output. The beginning of your file should be

?php session_start(); ?
html
...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_SESSION var sometimes set, sometimes not

2003-11-24 Thread Anthony Whipple
I just tried that.  It made no change.  Still sometimes works, sometimes
doesn't.  It's on the order of clicks.  It may work three times in a row,
then fail a couple times.  It's very strange.

John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Anthony Whipple wrote:

  The following code sometimes produces output indicating that the session
  variables have been set, and sometimes is says that they have not been
set.
  Unfortunately the server is not mine to configure, but if there is a
problem
  with it, I can get in touch with the right people.  Is the script
properly
  written?  Is it a server problem?
 
  html
  head
   titleTest stuff.../title
  /head
  body
 
  ?php
  session_start(); // enable session level global variables

 This shouldn't work at all. You need to have session_start() before any
 HTML or output. The beginning of your file should be

 ?php session_start(); ?
 html
 ...

 -- 
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] _SESSION, _POST, and _GET

2003-11-17 Thread Marek Kilimajer
David T-G wrote:
Yeah.  In fact, about half an hour ago I figured that I was spending more
time figuring out how to extract in the right order -- or in a limited
way -- than I would just doing it right, so I started running through the
code looking for any $pw and friends to change :-)
When register_globals are on, the order in which variables are extracted 
are controled by gpc_order setting. G - GET, P - POST, C - COOKIE, later 
overwrite earlier.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] _SESSION, _POST, and _GET

2003-11-16 Thread John W. Holmes
David T-G wrote:

I have successfully used extract() to
pull the data out of _SESSION each time; yay.
This whole question revolves around the reason you're even extract()ing 
anything to begin with... Why not just use the $_SESSION, $_POST, etc 
arrays where you need them. There's no reason to extract().

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] _SESSION, _POST, and _GET

2003-11-16 Thread David T-G
John, et al --

...and then John W. Holmes said...
% 
% David T-G wrote:
% 
% I have successfully used extract() to
% pull the data out of _SESSION each time; yay.
% 
% This whole question revolves around the reason you're even extract()ing 
% anything to begin with... Why not just use the $_SESSION, $_POST, etc 
% arrays where you need them. There's no reason to extract().

OK; fair enough.  1) I was just shown it in a recent thread and it seemed
like a lifesaver :-)  2) I want to get our existing code rewritten to be
good and not lose stuff, like passwords and email addresses, that it's
supposed to remember -- as quickly as possible.

I know they're famous last words, but I figure I'll do it right later :-)
[Hey, I'm even thinking of a full top-down rewrite anyway!]


% 
% -- 
% ---John Holmes...
% 
% Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
% 
% php|architect: The Magazine for PHP Professionals – www.phparch.com


Thanks  TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] _SESSION, _POST, and _GET

2003-11-16 Thread John W. Holmes
David T-G wrote:

John, et al --

...and then John W. Holmes said...
% 
% David T-G wrote:
% 
% I have successfully used extract() to
% pull the data out of _SESSION each time; yay.
% 
% This whole question revolves around the reason you're even extract()ing 
% anything to begin with... Why not just use the $_SESSION, $_POST, etc 
% arrays where you need them. There's no reason to extract().

OK; fair enough.  1) I was just shown it in a recent thread and it seemed
like a lifesaver :-)  2) I want to get our existing code rewritten to be
good and not lose stuff, like passwords and email addresses, that it's
supposed to remember -- as quickly as possible.
I know they're famous last words, but I figure I'll do it right later :-)
[Hey, I'm even thinking of a full top-down rewrite anyway!]
If you're going to extract blindly from $_POST and $_GET, you might as 
well just turn register_globals back on; that's what you've basically got.

There's absolutely no reason to extract $_XXX['var'] so you can use $var 
instead of just using $_XXX['var'] wherever you need that value...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] _SESSION, _POST, and _GET

2003-11-16 Thread David T-G
John, et al --

...and then John W. Holmes said...
% 
% David T-G wrote:
% 
% ...and then John W. Holmes said...
% % 
% % This whole question revolves around the reason you're even extract()ing 
% % anything to begin with... Why not just use the $_SESSION, $_POST, etc 
% % arrays where you need them. There's no reason to extract().
% 
% OK; fair enough.  1) I was just shown it in a recent thread and it seemed
% like a lifesaver :-)  2) I want to get our existing code rewritten to be
% good and not lose stuff, like passwords and email addresses, that it's
% supposed to remember -- as quickly as possible.
% 
% I know they're famous last words, but I figure I'll do it right later :-)
% [Hey, I'm even thinking of a full top-down rewrite anyway!]
% 
% If you're going to extract blindly from $_POST and $_GET, you might as 
% well just turn register_globals back on; that's what you've basically got.

Urgh.  Yeah, I see your point.


% 
% There's absolutely no reason to extract $_XXX['var'] so you can use $var 
% instead of just using $_XXX['var'] wherever you need that value...

Yeah.  In fact, about half an hour ago I figured that I was spending more
time figuring out how to extract in the right order -- or in a limited
way -- than I would just doing it right, so I started running through the
code looking for any $pw and friends to change :-)

So thanks for the prod; I'm sure it's for the best.


% 
% -- 
% ---John Holmes...


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] $_SESSION[''] variable not get passed

2003-11-10 Thread Rob Burris
S.P.Vimala wrote:

   Now the session_id get passwd across forms but the session
variable does not get passwed.
   Any guess what is the problem.

-vimala/.

 

You need to call session_start() on frm2.php to resume the session

http://us2.php.net/manual/en/function.session-start.php

--
[EMAIL PROTECTED]
http://www.phpexamples.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] $_SESSION stuffs that come with php.ini

2003-09-30 Thread esctoday.com | Wouter van Vliet
Hmm .. I haven't been on the list for a while so it took me some time to
answer ;).. Anyways, what I believe is a possible cause for your problem is
that there simply ain't no session started. Maybe the always start session
before the php page request setting was On if not configured, but is now
Off in your ini file.

783 ; Initialize session on request startup.
784 session.auto_start = 0

Might wants to be changed to

783 ; Initialize session on request startup.
784 session.auto_start = 1 

Also check this one

773 ; Whether to use cookies.
774 session.use_cookies = 1

In combination with

850 ; trans sid support is disabled by default.
851 ; Use of trans sid may risk your users security.
852 ; Use this option with caution.
853 ; - User may send URL contains active session ID
854 ;   to other person via. email/irc/etc.
855 ; - URL that contains active session ID may be stored
856 ;   in publically accessible computer.
857 ; - User may access your site with the same session ID
858 ;   always using URL stored in browser's history or bookmarks.
859 session.use_trans_sid = 0

If both are set to 0, sessions simply won't work since PHP cannot know
about the session id. If session.use_cookies is enabled, and
session.use_trans_sid is not than you should have Cookies enabled in your
browser for sessions to work. 

Or if you're on Windows, pay special attention to

771 session.save_path = /tmp

Which should then be changed to smth like c:\temp

That's pretty much what I can say about it .. If neither of those work, just
read the entire [Session] section in the php.ini file.

Wouter

-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 26, 2003 9:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] $_SESSION stuffs that come with php.ini

I have been building the website for 6 months with everything and I didn't
have hte php.ini on it.  Just didn't realize it, so I create the php.ini
that come from php.ini_dist that came with php source code.  Now the
$_SESSION doesn't work.  I'm not able to make the php.ini to be like the one
that php work without it.  So, anyone know what is the default session
configuration?

Thanks...

-- 
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: [PHP] $_SESSION act funny...

2003-07-09 Thread Marek Kilimajer


Scott Fletcher wrote:

?
// Let's say $_SESSION['test'] already have the data as 'one'...
   @session_start();
   $SID = session_name().=.session_id();

   if ($_SESSION['test'] == one) { $_SESSION['test'] = two };
$_SESSION['test'] is now 'two', so the next test is true
   if ($_SESSION['test'] == two) { $_SESSION['test'] = three };
$_SESSION['test'] is now 'three', so the next test is true
   if ($_SESSION['test'] == three) { $_SESSION['test'] = four };
$_SESSION['test'] is now 'four', so the next test is true
   if ($_SESSION['test'] == four) { $_SESSION['test'] = one };
$_SESSION['test'] is now 'one' again
  echo a href='page1.php?$SID'Next Page/a;
?
--snip--




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_SESSION act funny...

2003-07-09 Thread Mike Migurski
If you go to the next webpage by using the same file (webpage) or a
$_SERVER['PHP_SELF'], the data in the $_SESSION array remain the same, it
does not change as it should.

snip

   if ($_SESSION['test'] == one) { $_SESSION['test'] = two };
   if ($_SESSION['test'] == two) { $_SESSION['test'] = three };
   if ($_SESSION['test'] == three) { $_SESSION['test'] = four };
   if ($_SESSION['test'] == four) { $_SESSION['test'] = one };

The code above will always result in $_SESSION['test'] == 'one', if you
start from any of the four tested values. Is there some other behavior you
are expecting?

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION act funny...

2003-07-09 Thread Scott Fletcher
I'm kind of expecting them to change because using the hyperlink to go to
the next webpage should be treated as such for the same file (webpage file).
The reason I'm using the same file is because of the navigation menu with
all of the menu options that go to the include file...


Mike Migurski [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 If you go to the next webpage by using the same file (webpage) or a
 $_SERVER['PHP_SELF'], the data in the $_SESSION array remain the same, it
 does not change as it should.

 snip

if ($_SESSION['test'] == one) { $_SESSION['test'] = two };
if ($_SESSION['test'] == two) { $_SESSION['test'] = three };
if ($_SESSION['test'] == three) { $_SESSION['test'] = four };
if ($_SESSION['test'] == four) { $_SESSION['test'] = one };

 The code above will always result in $_SESSION['test'] == 'one', if you
 start from any of the four tested values. Is there some other behavior you
 are expecting?

 -
 michal migurski- contact info and pgp key:
 sf/cahttp://mike.teczno.com/contact.html




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION act funny...

2003-07-09 Thread Scott Fletcher
Oh Ha ha...  I see what you meant..  The $_SESSION['test'] had already been
changed from one to two, then three, then four, then back to one.  I didn't
see that coming..  I thought it just start at one and haven't changed at
all.

Thanks!!!

Scott Fletcher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm kind of expecting them to change because using the hyperlink to go to
 the next webpage should be treated as such for the same file (webpage
file).
 The reason I'm using the same file is because of the navigation menu with
 all of the menu options that go to the include file...


 Mike Migurski [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  If you go to the next webpage by using the same file (webpage) or a
  $_SERVER['PHP_SELF'], the data in the $_SESSION array remain the same,
it
  does not change as it should.
 
  snip
 
 if ($_SESSION['test'] == one) { $_SESSION['test'] = two };
 if ($_SESSION['test'] == two) { $_SESSION['test'] = three };
 if ($_SESSION['test'] == three) { $_SESSION['test'] = four };
 if ($_SESSION['test'] == four) { $_SESSION['test'] = one };
 
  The code above will always result in $_SESSION['test'] == 'one', if you
  start from any of the four tested values. Is there some other behavior
you
  are expecting?
 
  -
  michal migurski- contact info and pgp key:
  sf/cahttp://mike.teczno.com/contact.html
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Ralph
Daniel,

Rather than sending them to a new page to validate the form and then
sending them back if a field is invalid, do the error checking from the
same script.

Here's an example, a bit simple but just to give you an idea.

For a better explanation, you should read this article which elaborates
on this method:

http://www.zend.com/zend/spotlight/form-pro-php4.php


?php 

if($HTTP_POST_VARS){

// check for required fields
if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
  $error_message = 'You did not provide all required fields' 
}

// any other error checking you want to do

?


?php 

// if error, print out error message
if($error_message){
  echo $error_message;
}

?

FORM METHOD=post ACTION=?php echo $PHP_SELF ?
INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo
$HTTP_POST_VARS['name'] ?
INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo
$HTTP_POST_VARS['email'] ?
and so on

INPUT TYPE=submit NAME=process_form VALUE=Submit

-Original Message-
From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2003 2:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP] $_SESSION as $key=$value

Is this valid to iterate over a form variables.?

foreach ($_SESSION as $key=$value) 

and another question,  do I need this form action=scripts/process.php
method=post  in my form?  

Im really struggling with $_SESSION.  Im trying to program smarter and
make friendlier applications.  

Ive submitted several emails dealing with this function and I apologize
for beating a dead horse, so to speak.  

I have a form with a few form fields.  Im working on an error function
that will take the data that was entered and pass it back to the form so
that the user will not have to input the data again.  If an error is
found I use the header function to go back to the form.  Im having
trouble with passing back the data.  Do I in my form setup a $_GET or
should I use the $_SESSION to call it.  I am also going to setup a few
css styles that highlight which field was found in error.  

Again, I apologize for my lack of vision and maybe a spark of light will
go off, and I will be able to make some connections to get this done.  

Dan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Daniel J. Rychlik
I read the document 4 times.  I understand how it works and now Im excited
about applying this to my application, however Im running into a problem.
Im recieving an error on my page.

I have this in my form.
input name =fname type=text value= ?php $HTTP_POST_VARS['fname']; ?
/

and when running, I recieve
Notice: Undefined index: fname

I also used the example from here
http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the same
message.

Any Ideas, to help me break through these barriers?

Thanks so much
Dan



- Original Message - 
From: Ralph [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 1:50 AM
Subject: RE: [PHP] $_SESSION as $key=$value


 Daniel,

 Rather than sending them to a new page to validate the form and then
 sending them back if a field is invalid, do the error checking from the
 same script.

 Here's an example, a bit simple but just to give you an idea.

 For a better explanation, you should read this article which elaborates
 on this method:

 http://www.zend.com/zend/spotlight/form-pro-php4.php


 ?php

 if($HTTP_POST_VARS){

 // check for required fields
 if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
   $error_message = 'You did not provide all required fields'
 }

 // any other error checking you want to do
 
 ?


 ?php

 // if error, print out error message
 if($error_message){
   echo $error_message;
 }

 ?

 FORM METHOD=post ACTION=?php echo $PHP_SELF ?
 INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo
 $HTTP_POST_VARS['name'] ?
 INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo
 $HTTP_POST_VARS['email'] ?
 and so on

 INPUT TYPE=submit NAME=process_form VALUE=Submit

 -Original Message-
 From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 2:40 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] $_SESSION as $key=$value

 Is this valid to iterate over a form variables.?

 foreach ($_SESSION as $key=$value)

 and another question,  do I need this form action=scripts/process.php
 method=post  in my form?

 Im really struggling with $_SESSION.  Im trying to program smarter and
 make friendlier applications.

 Ive submitted several emails dealing with this function and I apologize
 for beating a dead horse, so to speak.

 I have a form with a few form fields.  Im working on an error function
 that will take the data that was entered and pass it back to the form so
 that the user will not have to input the data again.  If an error is
 found I use the header function to go back to the form.  Im having
 trouble with passing back the data.  Do I in my form setup a $_GET or
 should I use the $_SESSION to call it.  I am also going to setup a few
 css styles that highlight which field was found in error.

 Again, I apologize for my lack of vision and maybe a spark of light will
 go off, and I will be able to make some connections to get this done.

 Dan



 -- 
 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: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Ralph
I think this may be because you did not include echo in:

value= ?php echo $HTTP_POST_VARS['fname']; ?

so try this:

input name =fname type=text value= ?php echo
$HTTP_POST_VARS['fname']; ?


-Original Message-
From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 13, 2003 4:28 PM
To: Ralph; [EMAIL PROTECTED]
Subject: Re: [PHP] $_SESSION as $key=$value

I read the document 4 times.  I understand how it works and now Im
excited
about applying this to my application, however Im running into a
problem.
Im recieving an error on my page.

I have this in my form.
input name =fname type=text value= ?php $HTTP_POST_VARS['fname'];
?
/

and when running, I recieve
Notice: Undefined index: fname

I also used the example from here
http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the
same
message.

Any Ideas, to help me break through these barriers?

Thanks so much
Dan



- Original Message - 
From: Ralph [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 1:50 AM
Subject: RE: [PHP] $_SESSION as $key=$value


 Daniel,

 Rather than sending them to a new page to validate the form and then
 sending them back if a field is invalid, do the error checking from
the
 same script.

 Here's an example, a bit simple but just to give you an idea.

 For a better explanation, you should read this article which
elaborates
 on this method:

 http://www.zend.com/zend/spotlight/form-pro-php4.php


 ?php

 if($HTTP_POST_VARS){

 // check for required fields
 if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
   $error_message = 'You did not provide all required fields'
 }

 // any other error checking you want to do
 
 ?


 ?php

 // if error, print out error message
 if($error_message){
   echo $error_message;
 }

 ?

 FORM METHOD=post ACTION=?php echo $PHP_SELF ?
 INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo
 $HTTP_POST_VARS['name'] ?
 INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo
 $HTTP_POST_VARS['email'] ?
 and so on

 INPUT TYPE=submit NAME=process_form VALUE=Submit

 -Original Message-
 From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 2:40 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] $_SESSION as $key=$value

 Is this valid to iterate over a form variables.?

 foreach ($_SESSION as $key=$value)

 and another question,  do I need this form
action=scripts/process.php
 method=post  in my form?

 Im really struggling with $_SESSION.  Im trying to program smarter and
 make friendlier applications.

 Ive submitted several emails dealing with this function and I
apologize
 for beating a dead horse, so to speak.

 I have a form with a few form fields.  Im working on an error function
 that will take the data that was entered and pass it back to the form
so
 that the user will not have to input the data again.  If an error is
 found I use the header function to go back to the form.  Im having
 trouble with passing back the data.  Do I in my form setup a $_GET or
 should I use the $_SESSION to call it.  I am also going to setup a few
 css styles that highlight which field was found in error.

 Again, I apologize for my lack of vision and maybe a spark of light
will
 go off, and I will be able to make some connections to get this done.

 Dan



 -- 
 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: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Daniel J. Rychlik
I tried to echo it as well, I recieved the same message.

- Original Message - 
From: Ralph [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 6:50 PM
Subject: RE: [PHP] $_SESSION as $key=$value


 I think this may be because you did not include echo in:

 value= ?php echo $HTTP_POST_VARS['fname']; ?

 so try this:

 input name =fname type=text value= ?php echo
 $HTTP_POST_VARS['fname']; ?


 -Original Message-
 From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 13, 2003 4:28 PM
 To: Ralph; [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSION as $key=$value

 I read the document 4 times.  I understand how it works and now Im
 excited
 about applying this to my application, however Im running into a
 problem.
 Im recieving an error on my page.

 I have this in my form.
 input name =fname type=text value= ?php $HTTP_POST_VARS['fname'];
 ?
 /

 and when running, I recieve
 Notice: Undefined index: fname

 I also used the example from here
 http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the
 same
 message.

 Any Ideas, to help me break through these barriers?

 Thanks so much
 Dan



 - Original Message - 
 From: Ralph [EMAIL PROTECTED]
 To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Friday, June 13, 2003 1:50 AM
 Subject: RE: [PHP] $_SESSION as $key=$value


  Daniel,
 
  Rather than sending them to a new page to validate the form and then
  sending them back if a field is invalid, do the error checking from
 the
  same script.
 
  Here's an example, a bit simple but just to give you an idea.
 
  For a better explanation, you should read this article which
 elaborates
  on this method:
 
  http://www.zend.com/zend/spotlight/form-pro-php4.php
 
 
  ?php
 
  if($HTTP_POST_VARS){
 
  // check for required fields
  if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
$error_message = 'You did not provide all required fields'
  }
 
  // any other error checking you want to do
  
  ?
 
 
  ?php
 
  // if error, print out error message
  if($error_message){
echo $error_message;
  }
 
  ?
 
  FORM METHOD=post ACTION=?php echo $PHP_SELF ?
  INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo
  $HTTP_POST_VARS['name'] ?
  INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo
  $HTTP_POST_VARS['email'] ?
  and so on
 
  INPUT TYPE=submit NAME=process_form VALUE=Submit
 
  -Original Message-
  From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 12, 2003 2:40 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] $_SESSION as $key=$value
 
  Is this valid to iterate over a form variables.?
 
  foreach ($_SESSION as $key=$value)
 
  and another question,  do I need this form
 action=scripts/process.php
  method=post  in my form?
 
  Im really struggling with $_SESSION.  Im trying to program smarter and
  make friendlier applications.
 
  Ive submitted several emails dealing with this function and I
 apologize
  for beating a dead horse, so to speak.
 
  I have a form with a few form fields.  Im working on an error function
  that will take the data that was entered and pass it back to the form
 so
  that the user will not have to input the data again.  If an error is
  found I use the header function to go back to the form.  Im having
  trouble with passing back the data.  Do I in my form setup a $_GET or
  should I use the $_SESSION to call it.  I am also going to setup a few
  css styles that highlight which field was found in error.
 
  Again, I apologize for my lack of vision and maybe a spark of light
 will
  go off, and I will be able to make some connections to get this done.
 
  Dan
 
 
 
  -- 
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread John Nichel
Change error reporting in the php.ini to NOT include notices.

Echo out the variable

echo ( $_POST['fname'] );

All the notice is telling you is that $HTTP_POST_VARS['fname'] doesn't 
exist, which it isn't if you haven't posted it to this page.

Daniel J. Rychlik wrote:
I read the document 4 times.  I understand how it works and now Im excited
about applying this to my application, however Im running into a problem.
Im recieving an error on my page.
I have this in my form.
input name =fname type=text value= ?php $HTTP_POST_VARS['fname']; ?
/
and when running, I recieve
Notice: Undefined index: fname
I also used the example from here
http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the same
message.
Any Ideas, to help me break through these barriers?

Thanks so much
Dan


- Original Message - 
From: Ralph [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 1:50 AM
Subject: RE: [PHP] $_SESSION as $key=$value



Daniel,

Rather than sending them to a new page to validate the form and then
sending them back if a field is invalid, do the error checking from the
same script.
Here's an example, a bit simple but just to give you an idea.

For a better explanation, you should read this article which elaborates
on this method:
http://www.zend.com/zend/spotlight/form-pro-php4.php

?php

if($HTTP_POST_VARS){

// check for required fields
if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
 $error_message = 'You did not provide all required fields'
}
// any other error checking you want to do

?
?php

// if error, print out error message
if($error_message){
 echo $error_message;
}
?

FORM METHOD=post ACTION=?php echo $PHP_SELF ?
INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo
$HTTP_POST_VARS['name'] ?
INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo
$HTTP_POST_VARS['email'] ?
and so on
INPUT TYPE=submit NAME=process_form VALUE=Submit

-Original Message-
From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 2:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP] $_SESSION as $key=$value
Is this valid to iterate over a form variables.?

foreach ($_SESSION as $key=$value)

and another question,  do I need this form action=scripts/process.php
method=post  in my form?
Im really struggling with $_SESSION.  Im trying to program smarter and
make friendlier applications.
Ive submitted several emails dealing with this function and I apologize
for beating a dead horse, so to speak.
I have a form with a few form fields.  Im working on an error function
that will take the data that was entered and pass it back to the form so
that the user will not have to input the data again.  If an error is
found I use the header function to go back to the form.  Im having
trouble with passing back the data.  Do I in my form setup a $_GET or
should I use the $_SESSION to call it.  I am also going to setup a few
css styles that highlight which field was found in error.
Again, I apologize for my lack of vision and maybe a spark of light will
go off, and I will be able to make some connections to get this done.
Dan



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Lars Torben Wilson
On Fri, 2003-06-13 at 16:28, Daniel J. Rychlik wrote:
 I read the document 4 times.  I understand how it works and now Im excited
 about applying this to my application, however Im running into a problem.
 Im recieving an error on my page.
 
 I have this in my form.
 input name =fname type=text value= ?php $HTTP_POST_VARS['fname']; ?
 /
 
 and when running, I recieve
 Notice: Undefined index: fname

This is because when the form is first submitted, nothing has been
submitted, and thus $HTTP_POST_VARS['fname'] has no value. PHP is
simply warning you that you're trying to use an unitialized value.

Check the value first and you'll not have a problem with it:

?php
$output_fname = isset($_POST['fname']) ? $_POST['fname'] : '';
?
input name =fname type=text value=?php echo $output_fname ? /

If the first line looks odd, check out:

   http://ca2.php.net/manual/en/language.expressions.php

You could just turn down your error reporting, but all that does is
hide from you the fact that you're using code with problems in it. You
should make sure the code executes in a development environment with
full error reporting on without warnings or notices, before you turn off
error display on the production box.


Torben

 I also used the example from here
 http://www.zend.com/zend/spotlight/form-pro-php4.php and I recieved the same
 message.
 
 Any Ideas, to help me break through these barriers?
 
 Thanks so much
 Dan
 
 
 
 - Original Message - 
 From: Ralph [EMAIL PROTECTED]
 To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Friday, June 13, 2003 1:50 AM
 Subject: RE: [PHP] $_SESSION as $key=$value
 
 
  Daniel,
 
  Rather than sending them to a new page to validate the form and then
  sending them back if a field is invalid, do the error checking from the
  same script.
 
  Here's an example, a bit simple but just to give you an idea.
 
  For a better explanation, you should read this article which elaborates
  on this method:
 
  http://www.zend.com/zend/spotlight/form-pro-php4.php
 
 
  ?php
 
  if($HTTP_POST_VARS){
 
  // check for required fields
  if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
$error_message = 'You did not provide all required fields'
  }
 
  // any other error checking you want to do
  
  ?
 
 
  ?php
 
  // if error, print out error message
  if($error_message){
echo $error_message;
  }
 
  ?
 
  FORM METHOD=post ACTION=?php echo $PHP_SELF ?
  INPUT TYPE=text NAME=name SIZE=20 VALUE=?php echo
  $HTTP_POST_VARS['name'] ?
  INPUT TYPE=text NAME=email SIZE=20 VALUE=?php echo
  $HTTP_POST_VARS['email'] ?
  and so on
 
  INPUT TYPE=submit NAME=process_form VALUE=Submit
 
  -Original Message-
  From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 12, 2003 2:40 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] $_SESSION as $key=$value
 
  Is this valid to iterate over a form variables.?
 
  foreach ($_SESSION as $key=$value)
 
  and another question,  do I need this form action=scripts/process.php
  method=post  in my form?
 
  Im really struggling with $_SESSION.  Im trying to program smarter and
  make friendlier applications.
 
  Ive submitted several emails dealing with this function and I apologize
  for beating a dead horse, so to speak.
 
  I have a form with a few form fields.  Im working on an error function
  that will take the data that was entered and pass it back to the form so
  that the user will not have to input the data again.  If an error is
  found I use the header function to go back to the form.  Im having
  trouble with passing back the data.  Do I in my form setup a $_GET or
  should I use the $_SESSION to call it.  I am also going to setup a few
  css styles that highlight which field was found in error.
 
  Again, I apologize for my lack of vision and maybe a spark of light will
  go off, and I will be able to make some connections to get this done.
 
  Dan
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $_SESSION question

2002-11-14 Thread Ernest E Vogelsinger
At 02:18 15.11.2002, Jochen Kächelin said:
[snip]
How can I process $_SESSION variables if the user disables cookies
and session.use_trans_sid = 0 ?
[snip] 

Simply put - you can't.

You need a way to transmit the session identifier, and AFAIK there's
nothing except either cookies or SID.

Using SID for security relevant issues presents a problem - users can send
links with a SID to friends by mail or else, so this is not really a secure
solution. However there are numerous application parts where no security is
involved, and sessions are just used to construct a site - it's unnecessary
IMHO to avoid SID use here.

On our server we have disabled session cookies in general, as a courtesy to
our users. However when logged in we require a user to accept a cookie. The
value of this cookie is randomly generated (something like md5(rand())),
and changes with every click. This value (we call it a login token is
also stored in session data to verify the cookie against the session. If no
user token, or a wrong token, is transmitted, we assume a hijacked
session and automatically logout the user. (there's more to it, but
basically you get the idea)


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $_SESSION question

2002-11-14 Thread Sascha Cunz
 Simply put - you can't.

 You need a way to transmit the session identifier, and AFAIK there's
 nothing except either cookies or SID.

 Using SID for security relevant issues presents a problem - users can send
 links with a SID to friends by mail or else, so this is not really a secure
 solution. However there are numerous application parts where no security is
 involved, and sessions are just used to construct a site - it's unnecessary
 IMHO to avoid SID use here.

 On our server we have disabled session cookies in general, as a courtesy to
 our users. However when logged in we require a user to accept a cookie. The
 value of this cookie is randomly generated (something like md5(rand())),
 and changes with every click. This value (we call it a login token is
 also stored in session data to verify the cookie against the session. If no
 user token, or a wrong token, is transmitted, we assume a hijacked
 session and automatically logout the user. (there's more to it, but
 basically you get the idea)

This sounds like a pretty good idea to work around that problem :-)

Does this system work, if the user decides to split one session accross 
multiple Browser-Windows, i.e. the uses the Open in new window-Function 
of most browsers?

-Sascha

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $_SESSION question

2002-11-14 Thread Sascha Cunz
Hi Jochen,

 How can I process $_SESSION variables if the user disables cookies
 and session.use_trans_sid = 0 ?

You could use a combination of outputbuffering and a self-written 
session-handler.
So you could build a trans_sid-alike system, that would do more checks (i.e. 
compare IP-Addresses) to validate, if a session is really the one it is 
claiming. (Of course this would be slower as trans_sid's and ain't that easy 
to do)

-Sascha

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




  1   2   >