$_SESSION v. $_COOKIE

Posted by taeja87 on Stack Overflow See other posts from Stack Overflow or by taeja87
Published on 2012-07-02T01:46:49Z Indexed on 2012/07/08 21:16 UTC
Read the original article Hit count: 195

Filed under:
|
|

I learned about $_SESSION about several weeks ago when creating a login page. I can successfully login and use it with variables. Currently I am trying to understand $_SESSION and $_COOKIE. Please correct me if I am wrong, I can use $_SESSION when logging in and moving around pages. With $_COOKIE, it is used to remember when I last visit and preferences.

Another thing involving cookies is that when websites use advertisements (for example: Google AdSense), they use the cookies to track when visitor click on a advertisement, right?

I can use both ($_SESSION & $_COOKIE)? I read somewhere that you can store the session_id as value for the cookie.

Also, I read about security which let to me finding this: What do I need to store in the php session when user logged in?. Is using session_regenerate_id good for when a user comes back to the site?

And this: How to store a cookie with php involving uniqid.

For those wanting to know about the login, I use email and password. That way the user can be able to change their username.

I look forward to learning more about these two from anybody who would like to share their knowledge about it. If I asked too many question, you can just answer the one that you have more experience with.

If you need more information, just ask since I might have forgotten to include something.

Thank You.


Found this: What risks should I be aware of before allowing advertisements being placed on my website?

© Stack Overflow or respective owner

Related posts about php

Related posts about session