dhimok Posted June 26, 2007 Share Posted June 26, 2007 Hello everyone. I have this question Is it possible to control cookies from my own domain stored on users computers? I wonder if I can change the expiry date, increase or decrease or delete them, while they are already set from before Thanks Link to comment https://forums.phpfreaks.com/topic/57309-_cookie-question/ Share on other sites More sharing options...
aim25 Posted June 26, 2007 Share Posted June 26, 2007 Yes you can, very easily too. Link to comment https://forums.phpfreaks.com/topic/57309-_cookie-question/#findComment-283300 Share on other sites More sharing options...
dhimok Posted June 26, 2007 Author Share Posted June 26, 2007 I would like to add some more details: Lets say I store a cookie when a user enters my page that will expire in 1 year. Next time the same user enters the page it wont set the cookie again, unless its not there. Now I want that cookie which is stored to expire in 3 days. Is this possible and if yes then how Link to comment https://forums.phpfreaks.com/topic/57309-_cookie-question/#findComment-283322 Share on other sites More sharing options...
corillo181 Posted June 26, 2007 Share Posted June 26, 2007 i think before you learn to modify something you should learn how to make it. http://www.tutorialized.com/tutorials/PHP/Cookies-and-Sessions/1 Link to comment https://forums.phpfreaks.com/topic/57309-_cookie-question/#findComment-283329 Share on other sites More sharing options...
dhimok Posted June 26, 2007 Author Share Posted June 26, 2007 This is what I did. I think its ok if(!isset($_COOKIE["uid"])) { $uid = sha1(session_id().@time()); $expire1 = 365*24*3600; // 1 year setcookie("uid", $uid, (time() + $expire)); } else { $expire2 = 7*24*3600; // 1 week; setcookie("uid", $_COOKIE["uid"], (time() + $expire2)); } Any other ideas would be appriciated Link to comment https://forums.phpfreaks.com/topic/57309-_cookie-question/#findComment-283337 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.