Hey Guys
Im busy with my logic script and I am giving the user the ability to either just log in for a session (normal session usage) or "remember me" which then creates a cookie. Now I have the session thing under control.
Once the user has been authenticated, I create a session variable for username, active (which is 1) and then one called $_SESSION = session_id();
On each page I authenticate the user by checking if the $_SESSION["username"] matches the username in the database and also check if the $_SESSION["id"] is infact the session_id(); With this, I feel the security is a little stronger than just checking the session exist or just checking a username.
Now for the cookie I want to do something similiar. I have already setcookie("username",$username) but I am not sure if there is a php command to check if the cookiename is the same as a cookie_id(). Is there even something called cookie_id? Would it matter seeing that the user can gain access to it anyways? What is the best form of security using cookies?