Quote:
Originally posted by real_in if session_start gonna do all, then why i need cookies |
You don't...I just said way more then I should, so please ignore that part...sorry!
Quote:
Originally posted by real_in but i wanted to ask, suppose i set session variables in the index.php and do i need to include this index.php in everypage where i need session data ?? but if i will do that then it will let the user to directly point onto that page and generate the data.. |
No, you don't need to include the index.php page. To use sessions, all you need to do is this:
On every page, put this at the top: session_start();
As long as you have that, you can always set and access variables, for example:
On a login page you might do this:
$_SESSION['username'] = 'Fred'; // sets the variable
Then on every page after, you might want their username, so you'd get it like this:
$username = $_SESSION['username']; // gets the username
PHP will handle all session-related details for you, as long as you have the session_start(); at the top!
Quote:
Originally posted by real_in also i want to know that why i need to generate session IDs ?
i mean is it any way mandatory to generate them ? and do i need cookies or query string in URL to maintain them, or it is jus session_start which gonnna do eevry thing.. |
You don't need generate session IDs, PHP will do that for you. session_start(); will do the trick. Try it out...PHP is magical like that.