Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Curt Zirzow
* Thus wrote Shaun Campbell ([EMAIL PROTECTED]):
> That's it. Setting use_trans_sid to 1 got sessions working.  I'm now getting
> PHPSESSID=7398a182a64f0b2603e369812e130727 appended to the end of the
> page2.php URL and only one session file in my temp directory.
> 
> One final question. In the php.ini file it says that
> 
> "Use of trans sid may risk your users security.
> ; Use this option with caution."
> 
> If you don't use this option because of the security impications how else
> should you get sessions working?
> 

You turn on the use_cookie option in the php.ini file. And ensure
your web browser is accepting cookies.


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Shaun Campbell
That's it. Setting use_trans_sid to 1 got sessions working.  I'm now getting
PHPSESSID=7398a182a64f0b2603e369812e130727 appended to the end of the
page2.php URL and only one session file in my temp directory.

One final question. In the php.ini file it says that

"Use of trans sid may risk your users security.
; Use this option with caution."

If you don't use this option because of the security impications how else
should you get sessions working?

Thanks

Shaun

PS Marek I'd forgotten but I'd got cookies working yesterday using the code
you suggested.

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Marek Kilimajer
If you want to check for cookie add

echo "cookie = ".$_COOKIE[session_name()];

to the second page.

To check if transparent sessions are enabled look into phpinfo() output 
-> session.use_trans_sid

Shaun Campbell wrote:
I've tried the suggested code changes and no difference :(  I just don't
think sessions are working for me at all.
I said in my original posting that the second page was creating an empty
file in my session.save_path directory as though the second page has no
reference to the first one.
In my save_path directory I have the following files:

sess_8e603c46412d9c4dd3fa6bf3d98c100f0 KB File23/10/2003 10:37
sess_f548763ea84f7d812539720142ac6efe1 KB File23/10/2003 10:37
The top one presumably created by page 2 is empty and the bottom one
contains
foo|s:5:"Hello";bar|s:5:"World";

I don't know how sessions work in php and whether they use cookies or not
but it seems to me that the session_start() on page 2 is creating a new
session instead of referring to the current one.
Jason how do I check for those settings? I see nothing in php.ini that
refers to transparent sessions and I believe my browser is accepting
cookies.  Could it be an Apache configuration issue?  I thought sessions
were maintained on the server somehow.
Thanks

Shaun





"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Wednesday 22 October 2003 22:08, Shaun Campbell wrote:

I've got a problem getting sessions to work and I wondered if anyone
could

offer any advice.

The example I am using is to get one page to set variables in a session
and

then use another page to retrieve them.  I am using 4.3.4RC2 and prior
to

that 4.3..3 on Win2k with IE6 and Apache 1.3.22.

The code is:
[snip]

Code looks OK.

One explanation: you have not enabled transparent sessions, and your
browser

is not accepting cookies.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Sturgeon's Law:
90% of everything is crud.
*/


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


Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Shaun Campbell
I've tried the suggested code changes and no difference :(  I just don't
think sessions are working for me at all.

I said in my original posting that the second page was creating an empty
file in my session.save_path directory as though the second page has no
reference to the first one.

In my save_path directory I have the following files:

sess_8e603c46412d9c4dd3fa6bf3d98c100f0 KB File23/10/2003 10:37
sess_f548763ea84f7d812539720142ac6efe1 KB File23/10/2003 10:37

The top one presumably created by page 2 is empty and the bottom one
contains

foo|s:5:"Hello";bar|s:5:"World";

I don't know how sessions work in php and whether they use cookies or not
but it seems to me that the session_start() on page 2 is creating a new
session instead of referring to the current one.

Jason how do I check for those settings? I see nothing in php.ini that
refers to transparent sessions and I believe my browser is accepting
cookies.  Could it be an Apache configuration issue?  I thought sessions
were maintained on the server somehow.

Thanks

Shaun






"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wednesday 22 October 2003 22:08, Shaun Campbell wrote:
> > I've got a problem getting sessions to work and I wondered if anyone
could
> > offer any advice.
> >
> > The example I am using is to get one page to set variables in a session
and
> > then use another page to retrieve them.  I am using 4.3.4RC2 and prior
to
> > that 4.3..3 on Win2k with IE6 and Apache 1.3.22.
>
> >
> > The code is:
>
> [snip]
>
> Code looks OK.
>
> One explanation: you have not enabled transparent sessions, and your
browser
> is not accepting cookies.
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Sturgeon's Law:
> 90% of everything is crud.
> */

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread Jason Wong
On Wednesday 22 October 2003 22:08, Shaun Campbell wrote:
> I've got a problem getting sessions to work and I wondered if anyone could
> offer any advice.
>
> The example I am using is to get one page to set variables in a session and
> then use another page to retrieve them.  I am using 4.3.4RC2 and prior to
> that 4.3..3 on Win2k with IE6 and Apache 1.3.22.

>
> The code is:

[snip]

Code looks OK. 

One explanation: you have not enabled transparent sessions, and your browser 
is not accepting cookies.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Sturgeon's Law:
90% of everything is crud.
*/

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread John Nichel
Chris Boget wrote:
Okay, so we're back to square onewhy his sessions aren't working. 
This thread has been snipped too much, and I've already deleted the 
original, so I don't have the code that wasn't working.


Sadly, I don't have the original, either. :|
I just pulled it from the archives on php.net, cut and pasted his code 
into two files on my machine, tested it, and it worked fine.  Guess we 
have to wait for the OP to come back and let us know what's wrong. :)

On a side note, Chris, are you in Louisiana?


Yes, why?

Chris

Just saw the wild.net email address, and I knew that they're located on 
my side of the lake (as well as in the UK).  I applied for a php 
position at Wild.net a while backy'all ready to hire me yet?  *L* 
Do you happen to know a guy by the name of Robert Collins?

--
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] Newbie - Can't get sessions to work

2003-10-22 Thread Chris Boget
> Okay, so we're back to square onewhy his sessions aren't working. 
> This thread has been snipped too much, and I've already deleted the 
> original, so I don't have the code that wasn't working.

Sadly, I don't have the original, either. :|
 
> On a side note, Chris, are you in Louisiana?

Yes, why?

Chris

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread John Nichel
Chris Boget wrote:
";
echo "bar = {$_SESSION['bar']}";
Not when it's inside a string.
His statements should output the following:
foo = somevalue
bar = anothervalue
Also... he's using { and } because you can't access an array's value
unless it's within curly braces.


Not entirely true.  You can still do the following:

echo "foo = $_SESSION[foo]";
echo "bar = $_SESSION[bar]";
Chris

Okay, so we're back to square onewhy his sessions aren't working. 
This thread has been snipped too much, and I've already deleted the 
original, so I don't have the code that wasn't working.

On a side note, Chris, are you in Louisiana?

--
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] Newbie - Can't get sessions to work

2003-10-22 Thread Chris Boget
>> >  echo "foo = {$_SESSION['foo']}";
>>  echo "bar = {$_SESSION['bar']}";
> Not when it's inside a string.
> His statements should output the following:
> foo = somevalue
> bar = anothervalue
> Also... he's using { and } because you can't access an array's value
> unless it's within curly braces.

Not entirely true.  You can still do the following:

echo "foo = $_SESSION[foo]";
echo "bar = $_SESSION[bar]";

Chris

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread John Nichel
Chris W. Parker wrote:
John Nichel 
on Wednesday, October 22, 2003 11:33 AM said:

";
echo "bar = {$_SESSION['bar']}";
Get rid of the "foo =" and the "bar =".  when you use the single
equals sign, you're setting value


Not when it's inside a string.

His statements should output the following:

foo = somevalue
bar = anothervalue
Also... he's using { and } because you can't access an array's value
unless it's within curly braces.
Duh, that's what I get for just glancing at it.  This is why the 'other' 
John is wearing the crown now.  :)

--
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] Newbie - Can't get sessions to work

2003-10-22 Thread Chris W. Parker
John Nichel 
on Wednesday, October 22, 2003 11:33 AM said:

>> >  echo "foo = {$_SESSION['foo']}";
>>  echo "bar = {$_SESSION['bar']}";
> 
> Get rid of the "foo =" and the "bar =".  when you use the single
> equals sign, you're setting value

Not when it's inside a string.

His statements should output the following:


foo = somevalue
bar = anothervalue

Also... he's using { and } because you can't access an array's value
unless it's within curly braces.


Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread John Nichel
Daniel Guerrier wrote:
Your right :)

I think he's using the brackets instead of parenthesis
in the echo's.
Change the {} to ()
Yep, he is...didn't notice that on the first pass.  The code I cut and 
pasted from his with have errors

Fixed code

echo ( $_SESSION['foo'] . "\n" );
echo ( $_SESSION['bar'] );
--
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] Newbie - Can't get sessions to work

2003-10-22 Thread Daniel Guerrier
Your right :)

I think he's using the brackets instead of parenthesis
in the echo's.
Change the {} to ()

--- John Nichel <[EMAIL PROTECTED]> wrote:
> Daniel Guerrier wrote:
> > The second page should be
> > 
> >  > session_start();
> >  echo { $_SESSION['foo'] . "\n");
> >  echo { $_SESSION['bar'] };
> > ?>
> > 
> > you're missing the session_start()
> > 
> > You need it on every page that you plan to use
> session
> > on.
> 
> He has session_start() on page two.
> 
> 
> >>>
> >>>page2.php
> >>>--
> >>> >>> session_start();
> >>> echo "foo = {$_SESSION['foo']}";
> >>> echo "bar = {$_SESSION['bar']}";
> >>>?>
> >>
> >>Same here
> >>
> >> >> echo { $_SESSION['foo'] . "\n");
> >> echo { $_SESSION['bar'] };
> >>?>
> 
> 
> -- 
> 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
> 


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread John Nichel
Daniel Guerrier wrote:
The second page should be

\n");
 echo { $_SESSION['bar'] };
?>
you're missing the session_start()

You need it on every page that you plan to use session
on.
He has session_start() on page two.


page2.php
--

Same here

\n");
echo { $_SESSION['bar'] };
?>


--
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] Newbie - Can't get sessions to work

2003-10-22 Thread Daniel Guerrier
The second page should be

\n");
 echo { $_SESSION['bar'] };
?>

you're missing the session_start()

You need it on every page that you plan to use session
on.  

--- John Nichel <[EMAIL PROTECTED]> wrote:
> Shaun Campbell wrote:
> > I've got a problem getting sessions to work and I
> wondered if anyone could
> > offer any advice.
> > 
> > The example I am using is to get one page to set
> variables in a session and
> > then use another page to retrieve them.  I am
> using 4.3.4RC2 and prior to
> > that 4.3..3 on Win2k with IE6 and Apache 1.3.22.
> > 
> > The code is:
> > 
> > page1.php
> > --
> >  >  session_start();
> > 
> >  $_SESSION['foo'] = 'Hello';
> >  $_SESSION['bar'] = 'World';
> > 
> >  ?>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Variables set in session - hopefully???
> > 
> >  >  echo "foo = {$_SESSION['foo']}";
> >  echo "bar = {$_SESSION['bar']}";
> > ?>
> 
> Get rid of the "foo =" and the "bar =".  when you
> use the single equals 
> sign, you're setting value
> 
>   echo { $_SESSION['foo'] . "\n");
>  echo { $_SESSION['bar'] };
> ?>
> 
> > 
> >  />
> > 
> > 
> > 
> > 
> > 
> > page2.php
> > --
> >  >  session_start();
> >  echo "foo = {$_SESSION['foo']}";
> >  echo "bar = {$_SESSION['bar']}";
> > ?>
> 
> Same here
> 
>   echo { $_SESSION['foo'] . "\n");
>  echo { $_SESSION['bar'] };
> ?>
> 
> > On page 1 I am seeing the session variables
> displayed correctly i.e. Hello
> > World and I can see a session file created in my
> temp directory with the
> > correct values in there.  However, when I display
> page 2 the variables are
> > always displayed blank and what seems to happen is
> that a new empty session
> > file is created in my temp directory.  It's as
> though the second page is not
> > related to the same session somehow.  I've also
> tried lots of other examples
> > from books and on the net and I still can't get
> sessions to work.
> > 
> > Am I doing something wrong in connecting the two
> pages although I don't
> > close the browser down at all between the two?
> > 
> > Any ideas would be greatly appreciated.
> > 
> > Thanks
> > 
> > Shaun Campbell
> 
> 
> 
> -- 
> 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
> 


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-22 Thread John Nichel
Shaun Campbell wrote:
I've got a problem getting sessions to work and I wondered if anyone could
offer any advice.
The example I am using is to get one page to set variables in a session and
then use another page to retrieve them.  I am using 4.3.4RC2 and prior to
that 4.3..3 on Win2k with IE6 and Apache 1.3.22.
The code is:

page1.php
--

 $_SESSION['foo'] = 'Hello';
 $_SESSION['bar'] = 'World';
 ?>






Variables set in session - hopefully???

";
 echo "bar = {$_SESSION['bar']}";
?>
Get rid of the "foo =" and the "bar =".  when you use the single equals 
sign, you're setting value

\n");
echo { $_SESSION['bar'] };
?>





page2.php
--

Same here

\n");
echo { $_SESSION['bar'] };
?>
On page 1 I am seeing the session variables displayed correctly i.e. Hello
World and I can see a session file created in my temp directory with the
correct values in there.  However, when I display page 2 the variables are
always displayed blank and what seems to happen is that a new empty session
file is created in my temp directory.  It's as though the second page is not
related to the same session somehow.  I've also tried lots of other examples
from books and on the net and I still can't get sessions to work.
Am I doing something wrong in connecting the two pages although I don't
close the browser down at all between the two?
Any ideas would be greatly appreciated.

Thanks

Shaun Campbell


--
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