[PHP] More fun with sessions

2002-03-21 Thread James Taylor

How can I get a listing of all currently active sessions?

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




RE: [PHP] More Fun With Sessions!

2002-01-23 Thread Jeff Sheltren

Thanks, everyone for responding... after much headache I seem to have got it
working.  (not fixed, but working.)  I was running php 4.0.6 on linux where
the code worked.  I just installed php 4.0.4pl1 on the freebsd box and now
everything works great.  It was probably not the best solution, but it
works... and after this project php/apache will not be used on that server
anyway, so I guess that having an older version is not the worst thing to do
=)

-Jeff

> Your code works fine on my FreeBSD box running php 4.0.4pl1 but not one
running php 4.0.6 ...  May explain your linux issues? i.e. versions of php
...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] More Fun With Sessions!

2002-01-23 Thread Matt Schroebel

Your code works fine on my FreeBSD box running php 4.0.4pl1 but not one running php 
4.0.6 ...  May explain your linux issues? i.e. versions of php ...

-Original Message-
From: Richard Baskett [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 23, 2002 3:37 PM

You only need to register the variable once when you initiate the session. Also as of 
php 4.1 I believe you do not have to register your session vars you can just acccess 
them like $_SESSION['counter']:

http://www.php.net/manual/en/ref.session.php

Basically what I see you're doing is reregistering the variable on each page which 
initializes it as 0 and so when you do $counter++ you're always going to get 1..

> test.php:
>  session_start();
> session_register('counter');
> $counter++;
> echo("You have visited this page $counter times.\n");
> ?>
> click here
> 
> test2.php:
>  session_start();
> session_register('counter');
> $counter++;
> echo("You have visited this page $counter times.\n");
> ?>
> click here
> 
> Shouldn't this hold the same counter variable for both pages?  It 
> works fine on my linux box, but on the FreeBSD box, $counter is always 
> 1.  I think that if I could get something like this script working, 
> then the shopping cart would also work.  Sorry for the long message!  
> Any help would be greatly appreciated.
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] More Fun With Sessions!

2002-01-23 Thread Richard Baskett

You only need to register the variable once when you initiate the session.
Also as of php 4.1 I believe you do not have to register your session vars
you can just acccess them like $_SESSION['counter']:

http://www.php.net/manual/en/ref.session.php

Basically what I see you're doing is reregistering the variable on each page
which initializes it as 0 and so when you do $counter++ you're always going
to get 1..

Hope this helps!

Rick

"Dost thou love life? Then do not squander time; for that's the stuff life
is made of." - Ben Franklin

> From: "Jeff Sheltren" <[EMAIL PROTECTED]>
> Date: Wed, 23 Jan 2002 12:31:49 -0800
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] More Fun With Sessions!
> 
> Well, I was having problems getting sessions working at all on my FreeBSD
> box, but they are now working...
> But that leads me to more problems...
> 
> For any others that might have a problem w/ FreeBSD, try setting the
> referer_check to 0
> 'session.referer_check = 0'
> 
> Once I changed that things seem to be working, ie. I can get a simple count
> script to run with no probs, but here is where I come across a new problem.
> This script works fine (it counts as I reload it):
>  session_start();
> session_register('counter');
> $counter++;
> echo("You have visited this page $counter times.");
> ?>
> 
> What I am wanting to run on the site is a shopping cart app (along with some
> other scripts that utilize sessions) that I wrote myself.  Everything works
> fine on my home linux box, but doesn't seem to be working on the FreeBSD
> box.  Maybe I am just not using sessions properly, but it is bugging me
> because it works on the linux box...  Here's an example:
> 
> test.php:
>  session_start();
> session_register('counter');
> $counter++;
> echo("You have visited this page $counter times.\n");
> ?>
> click here
> 
> test2.php:
>  session_start();
> session_register('counter');
> $counter++;
> echo("You have visited this page $counter times.\n");
> ?>
> click here
> 
> Shouldn't this hold the same counter variable for both pages?  It works fine
> on my linux box, but on the FreeBSD box, $counter is always 1.  I think that
> if I could get something like this script working, then the shopping cart
> would also work.  Sorry for the long message!  Any help would be greatly
> appreciated.
> 
> Jeff
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] More Fun With Sessions!

2002-01-23 Thread Jeff Sheltren

Well, I was having problems getting sessions working at all on my FreeBSD
box, but they are now working...
But that leads me to more problems...

For any others that might have a problem w/ FreeBSD, try setting the
referer_check to 0
'session.referer_check = 0'

Once I changed that things seem to be working, ie. I can get a simple count
script to run with no probs, but here is where I come across a new problem.
This script works fine (it counts as I reload it):


What I am wanting to run on the site is a shopping cart app (along with some
other scripts that utilize sessions) that I wrote myself.  Everything works
fine on my home linux box, but doesn't seem to be working on the FreeBSD
box.  Maybe I am just not using sessions properly, but it is bugging me
because it works on the linux box...  Here's an example:

test.php:

click here

test2.php:

click here

Shouldn't this hold the same counter variable for both pages?  It works fine
on my linux box, but on the FreeBSD box, $counter is always 1.  I think that
if I could get something like this script working, then the shopping cart
would also work.  Sorry for the long message!  Any help would be greatly
appreciated.

Jeff



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]