Hi Gurus
I am basically sorry that I have to bother you about this. I am a PHP
beginner and I have been studying sessions and cookies over the last few
weeks. I have learned lots, but I am missing the big picture.
Is it like this:
1. user comes to site
2. user does something (e.g. a search) that may be useful later => session
is started and cookie is planted on the users computer, containing only the
session ID
3. each page now has session_start in it
4. user is asked to log-in to access more stuff (the session now identifies
the user to allow only certain people in certain places).
5. when the user comes back later the cookie may recognise him or her as the
one from last time (how and where do you retain the person's information if
the session is lost - can that be done in a MySql database?)
6. Alternative, the user can log-in (session was saved in a MySql Database
in that case...)
I start almost all my pages like this:
session_start() ;
ini_set('sessio n.cache_limiter ', 'private');
include_once("_ connectToDBFile .php"); // contains dbcon function
$dbcheck = dbcon(); // connects to Mysql Database
What does the second line mean (I have no idea!)
Also, right now, I pass the session ID in the URL. In an earlier question,
people told me that this is necessary, but some others have told me this is
not necessary. For your information, I store variables in my session like
- name
- email address
- other contact details
so that if people fill in a form (there are lots on the site) then they do
not have to retype it.
I also store people's searches on the site, so that they can go back to
previous searches, and I allow them to create "a basket" with items.
Ideally, I would like to store each person's session in the mysql database
so that I can analyse how the site is used and so that people can come back
later to their site. because the site is mainly for travellers, i am not
sure how useful cookies are going to be. I prefer them to sign in (using
their email and a password).
Any comments on my ideas and understanding of how it all works are greatly
appreciated.
Thank you
Nicolaas
I am basically sorry that I have to bother you about this. I am a PHP
beginner and I have been studying sessions and cookies over the last few
weeks. I have learned lots, but I am missing the big picture.
Is it like this:
1. user comes to site
2. user does something (e.g. a search) that may be useful later => session
is started and cookie is planted on the users computer, containing only the
session ID
3. each page now has session_start in it
4. user is asked to log-in to access more stuff (the session now identifies
the user to allow only certain people in certain places).
5. when the user comes back later the cookie may recognise him or her as the
one from last time (how and where do you retain the person's information if
the session is lost - can that be done in a MySql database?)
6. Alternative, the user can log-in (session was saved in a MySql Database
in that case...)
I start almost all my pages like this:
session_start() ;
ini_set('sessio n.cache_limiter ', 'private');
include_once("_ connectToDBFile .php"); // contains dbcon function
$dbcheck = dbcon(); // connects to Mysql Database
What does the second line mean (I have no idea!)
Also, right now, I pass the session ID in the URL. In an earlier question,
people told me that this is necessary, but some others have told me this is
not necessary. For your information, I store variables in my session like
- name
- email address
- other contact details
so that if people fill in a form (there are lots on the site) then they do
not have to retype it.
I also store people's searches on the site, so that they can go back to
previous searches, and I allow them to create "a basket" with items.
Ideally, I would like to store each person's session in the mysql database
so that I can analyse how the site is used and so that people can come back
later to their site. because the site is mainly for travellers, i am not
sure how useful cookies are going to be. I prefer them to sign in (using
their email and a password).
Any comments on my ideas and understanding of how it all works are greatly
appreciated.
Thank you
Nicolaas
Comment