Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

session id's

Recommended Posts

Ok I know everything I need to know about basic sections, I already found out about having to use session_start();
and it having to be the first line, I found out about
session_register()
being deprecated, and that you should instead use
$_SESSION['variablename'] = "whatever here";
permanently instead of session register.
I know how to check to see if a session is registered.  I have a few quick questions now, what about session id's do I need to do anything with them, if so what.  Should I go ahead and just do it with cookies, or do you think I should use a database, can I still use a database, and have the same affect, I just basically need a few pointed fingers.

Share this post


Link to post
Share on other sites
[quote author=businessman332211 link=topic=101686.msg402613#msg402613 date=1153754755]
Ok I know everything I need to know about basic sections ... I have a few quick questions now, what about session id's do I need to do anything with them, if so what.  Should I go ahead and just do it with cookies, or do you think I should use a database, can I still use a database, and have the same affect, I just basically need a few pointed fingers.
[/quote]

The answers to the questions depend on what it is that you're trying to accomplish.  Care to rephrase your questions into some sort of context?

Share this post


Link to post
Share on other sites
Alright
1. If I just go with straight original sessions.
I use session_start() at the top of every page, I set my sessions with the stuff I want.
At the top of each name below that I put if whatever and password protect the page, does session_start() set an id automatically.  basically is there anything at all I need to do to set an id, or to retrieve an id from a cookie, if I am just using standard cookies for the id's and files for hte session save locations.

2. Now if I decided to use databases, is it like an alternative to cookies, do they like save the session id's in the database, and the session information in the files, I was wanting sessions to save normally but maybe save session id's in a database, so people don't have to have cookies enabled, because unfortunately a large part of our population doesn't use cookies.

3. If I store all session information in the database, and session id then is there anything special I need to keep in mind, or anything extra I have to do to retrieve session information

4.  if I can and do store teh sessions in a file, and hte id's in a database, do I need to do anything more to retrieve the session id from teh database than I would need to do to retrieve it from a cookie

5.  Which is better/easier/more secure.

Share this post


Link to post
Share on other sites
[quote]1. If I just go with straight original sessions.
I use session_start() at the top of every page, I set my sessions with the stuff I want.
At the top of each name below that I put if whatever and password protect the page, does session_start() set an id automatically.  basically is there anything at all I need to do to set an id, or to retrieve an id from a cookie, if I am just using standard cookies for the id's and files for hte session save locations.[/quote]
sessions_start generates a session id automatically, if one hasnt been set. It wil also automaitcally resume a session if the session id is still valid.

If you want to store your sessions within a database you have to create your own [url=http://uk.php.net/manual/en/function.session-set-save-handler.php]session handler[/url], quite complex if you are starting with sessions. However the defualt behavior of a session is fine.

Share this post


Link to post
Share on other sites
Alright then I will go with the standard way for now, after I do a few sites using that, and get a little more well rounded, then I will start working on dealing with things afterwards.  And trying to do what I can about starting setting up my own Session Handling, this project isn't paying enough, and I need the basics, before I can jump to intermediate and advanced sessions.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.