I am trying to set a cookie to avoid repeat action by users.
Say I show user a profile. User can take an action and I save that profile's ID in a cookie:
setcookie("myCookie", $profileID, time()+7200, "/", ".mydomain.com" );
Now I can check to see if the user already took and action and prevent from repeat for 2 hours. Unfortunately if user views another profile and takes action there, the cookie will be overwritten by new profile's ID. Is there a way to avoid it? or do I need to dynamically generate cookie name as well?