Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Justin French

enable-trans-sid appends a session id to URLs, but it works in conjunction
with php's session functions.  Simply compiling with --enable-trans-sid or
appending it to the URL yourself will not maintain session.

using functions like session_start() and the registering of session
variables ($_SESSION['something'] = foo;) will establish/maintain a
session.

enable-trans-sid will only append a session ID to the URL for you if
needed... it's main use is for maintaining session across multiple pages
whilst not relying on cookies.

simply converting your files to .php and compiling with enable-trans-sid
will not give you sessions.


Justin French



on 30/06/02 5:47 AM, Tim Stoop ([EMAIL PROTECTED]) wrote:

 Hi people,
 
 Just a question, I'm building components for a customer who wants some
 interactivity within his site, but still wants to build the site himself.
 One thing that would be interesting would be Session management. Now, if I
 just tell him to make all his own pages with .php ext instead of .html,
 would did be enough if --enable-trans-sid is used (and php.ini is correctly
 configured)? It seems to work here, but I want to know if I forgot
 something important...


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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Hi Justin,

Thx for the reply

Justin French wrote:

 using functions like session_start() and the registering of session
 variables ($_SESSION['something'] = foo;) will establish/maintain a
 session.

Yes, I understand. Sessions need to be started. But once they have started, 
do I need to re-affirm the session on every page, or will it hold for a few 
pages, until the session-variables will be used again ...

 simply converting your files to .php and compiling with enable-trans-sid
 will not give you sessions.

... when I do this?

-- 
Kind regards,
Tim

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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Justin French

on 30/06/02 9:04 PM, Tim Stoop ([EMAIL PROTECTED]) wrote:

 Yes, I understand. Sessions need to be started. But once they have started,
 do I need to re-affirm the session on every page, or will it hold for a few
 pages, until the session-variables will be used again ...

Well, you really need to check out a decent article/tutorial on sessions,
because it's a lot more in depth than can possible be explained here.  But
as a bare minimum, each page would need to call session_start() BEFORE the
HTML tag or any other content is sent to the browser.

You'd also need to register variables to the session (otherwise what's the
point?)

What is the session to be used for?


 simply converting your files to .php and compiling with enable-trans-sid
 will not give you sessions.
 
 ... when I do this?

do what?


Justin French


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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Jason Wong

On Sunday 30 June 2002 19:04, Tim Stoop wrote:
 Hi Justin,

 Thx for the reply

 Justin French wrote:
  using functions like session_start() and the registering of session
  variables ($_SESSION['something'] = foo;) will establish/maintain a
  session.

 Yes, I understand. Sessions need to be started. But once they have started,
 do I need to re-affirm the session on every page, or will it hold for a few
 pages, until the session-variables will be used again ...

There is a setting in php.ini, session.auto_start, which enables php to 
automatically register a session. But as Justin suggests, you should refer to 
a decent article/book or manual for details.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
If you flaunt it, expect to have it trashed.
*/


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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Hi Justin,

Thx again for the answer.

Justin French wrote:

 Well, you really need to check out a decent article/tutorial on sessions,

Nah, I think I explain my question a little wierd and that's why you don't 
understand me... I've worked with sessions lots of times (although mostly 
in Java Servlets). Or something must be really crooked with my knowledge of 
standard sessions...

 because it's a lot more in depth than can possible be explained here.  But
 as a bare minimum, each page would need to call session_start() BEFORE the
 HTML tag or any other content is sent to the browser.

Ah yes, I forgot about that... I need to resume the session, of course. 
Would session.auto_start set to 1 work without these session_start()'s? The 
thing is, I need as less as possible of a hassle to have the sessions 
work... Read on for an explanation.

 You'd also need to register variables to the session (otherwise what's the
 point?)
 
 What is the session to be used for?

Well... For a shopping-cart actually :)

But not the standard kind. I'm building a set of components that a 
webdesigner can use easily, without actually understanding how the code 
works. The webdesigner (my customer) wants to build a site where his 
customers can browse to some products and put them in their shopping-cart 
with simple code. Something like:

HTML
HEAD
  bla bla..
/HEAD
BODY
H1Buy this product!/H1
Pbla bla/P
?php 
  include(functions.php);
  makeBuyButton(black shoes, size 34);
?
/BODY
/HTML

I do the work with the variables and all, he only needs to make sure 
everything looks fine. I used to do this with Cookies, but they're evil :) 
Besides, a session-solution a much prettier :) I want to know if the 
session is maintained if he makes use of the components and has all his 
files extend on .php, when I have --enable-trans-sid on and (as noted in 
this mail) session.auto_start.

I think this would work? I made a test-site locally, but I need to know the 
exact options that make this work, so I can inform the provider what to 
change (very helpful chaps over there, just don't know sh*t about PHP).

-- 
Kind regards,
Tim

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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Justin French

on 30/06/02 11:33 PM, Tim Stoop ([EMAIL PROTECTED]) wrote:

 Ah yes, I forgot about that... I need to resume the session, of course.
 Would session.auto_start set to 1 work without these session_start()'s?

I believe so... and Jason Wong has sent an email suggesting this.

 The 
 thing is, I need as less as possible of a hassle to have the sessions
 work... Read on for an explanation.

[snip]

I'd say everything will work out, depending of course on the code you're
writing to manage everything :)


It's worth pointing out that you may not really have to worry about the
session_start() call at the top of script.  In reality, you may replace this
with a single include() statement which contains a library of functions,
maintains the session, etc etc as the first line of the file.  Much simpler
than imposing yet another requirement on the host (portability is always an
issue), and much simpler than multiple includes and stuff scattered every
where.

? include('inc/header.inc'); ?  // includes sessions, functions, etc
HTML
HEAD
  bla bla..
/HEAD
BODY
H1Buy this product!/H1
Pbla bla/P
?=makeBuyButton(black shoes, size 34)?
/BODY
/HTML

Good luck.


Justin French


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




RE: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread John Holmes

Tim,

You might want to look into a good templating solution, too. You can
make it so the customer can maintain all of the HTML and you maintain
the PHP, and it's all kept separate. It's would be similar to what it
looks like you are doing now. 

Instead of telling the client to put ?=makeBuyButton(black shoes, size
34)?, you could do something like BuyButton type=shoes size=34,
which may be easier for someone with an HTML background to understand. 

It's up to you. 

---John Holmes...

 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 30, 2002 12:15 PM
 To: Tim Stoop; [EMAIL PROTECTED]
 Subject: Re: [PHP] [Session] SID automatically add on all pages?
 
 on 30/06/02 11:33 PM, Tim Stoop ([EMAIL PROTECTED]) wrote:
 
  Ah yes, I forgot about that... I need to resume the session, of
course.
  Would session.auto_start set to 1 work without these
session_start()'s?
 
 I believe so... and Jason Wong has sent an email suggesting this.
 
  The
  thing is, I need as less as possible of a hassle to have the
sessions
  work... Read on for an explanation.
 
 [snip]
 
 I'd say everything will work out, depending of course on the code
you're
 writing to manage everything :)
 
 
 It's worth pointing out that you may not really have to worry about
the
 session_start() call at the top of script.  In reality, you may
replace
 this
 with a single include() statement which contains a library of
functions,
 maintains the session, etc etc as the first line of the file.  Much
 simpler
 than imposing yet another requirement on the host (portability is
always
 an
 issue), and much simpler than multiple includes and stuff scattered
every
 where.
 
 ? include('inc/header.inc'); ?  // includes sessions, functions, etc
 HTML
 HEAD
   bla bla..
 /HEAD
 BODY
 H1Buy this product!/H1
 Pbla bla/P
 ?=makeBuyButton(black shoes, size 34)?
 /BODY
 /HTML
 
 Good luck.
 
 
 Justin French
 
 
 --
 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] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Thanks for the help guys. The one-line include is definitly a very good 
idea, which I'll use.

Templating is very interesting, although, only if it works exactly as you 
say, with HTML-like tags. I looked at Smart, patTemplate en some others, 
but they all use {} or [] style tags. In that case, I prefer de php. If 
anyone knows of a template-engine that can recognise the difference between 
a custom-tag with  and a HTML-tag, I'd appreciate the URL :)

For now, I'm going to make this work.

-- 
Kind regards,
Tim

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




RE: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread César Aracena

Well Tim, I don't have much time working with PHP, but I did study the
template format made by Ying Zhang. I found it when searching for a
shopping cart - PHP made - script. If you want to look at it, search
hotscripts for mymarket. To give you an idea, I make just one page
with session_start() for all my sites... in the header.inc which is
obviously inserted at the top of every page... This page also inserts
the login and logout functions, so I can make all the other pages
without having to worry about session management.

I don't know if this is going to help you, but it sure makes my life
easier when working with sessions.

C.

 -Original Message-
 From: Tim Stoop [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 30, 2002 3:05 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] [Session] SID automatically add on all pages?
 
 Thanks for the help guys. The one-line include is definitly a very
good
 idea, which I'll use.
 
 Templating is very interesting, although, only if it works exactly as
you
 say, with HTML-like tags. I looked at Smart, patTemplate en some
others,
 but they all use {} or [] style tags. In that case, I prefer de php.
If
 anyone knows of a template-engine that can recognise the difference
 between
 a custom-tag with  and a HTML-tag, I'd appreciate the URL :)
 
 For now, I'm going to make this work.
 
 --
 Kind regards,
 Tim
 
 --
 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