Jump to content

session id's


Ninjakreborn

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.
Link to comment
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?
Link to comment
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.
Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.