I currently have a script using sessions. I do understand that if the server cannot set a cookie on a web browser that PHP sees this and manipulates the HTML to include a hidden POST filed so that the form data is always being POSTed and stored in the server sessions.
>>I wonder if there are any ramifications for not using cookies?
Are you aware of session hijacking? If not, you may want to read the "session fixation" link from the PHP Session handling [php.net] page. Should give you a good feel for session management and possibilities.
a little off topic (sorry) but my friends are not as "into" the internet as i am, and are therefore (understandably)concerned about files (cookies) being put on their computers, i'm sure that sessions are the way to go, what are the best tutorials (besides php.net's) for learning to use sessions (note: i'm also pretty new into cookies...very basic)
Simply set a cookie using php and then check if its there if it isnt then cookies arent enabled.
Sorry I wasnt specific enough with my question :), how can you test to see if a session cookie was accepted by the client? I would rather not set a cookie just to check if the user has cookies enabled, there must be someway to check if the session cookie was accepted?
Assuming you aren't allowing the SID to be passed via URL...
It's as simple as setting a session variable. Next time you want to know if they accepted the cookie, check the session variable. It it isn't set, they didn't accept the cookie.
// If user logged in and we validated it as OK, set a session variable: $_SESSION['user_password'] = $_POST['user_password']; // Later on we want to know if the user logged in and accepted our cookie: if (!isset($_SESSION['user_password'])) return false;