| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 62119 | 2005-09-27 07:17:00 | Killing a cookie/session, once order has been placed | Morgenmuffel (187) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 391304 | 2005-09-27 07:17:00 | Hi All I want to be able to end a session ( destroy the cookie) once an order has been placed or after 3 days (if no order is placed) , This is the code I currently use, it deletes the cookie after 3 days fine, if(isset($_COOKIE["cartId"])) { return $_COOKIE["cartId"]; } else { // There is no cookie set. We will set the cookie and return the value of the users session ID session_start(); setcookie("cartId", session_id(), time() + ((3600 * 24) * 30)); @mysql_query("insert into cart_cookie(cookie_ID) values('".session_id()."')"); return session_id(); But i don't know how to kill the cookie once an order has been placed. Cheers Nigel |
Morgenmuffel (187) | ||
| 391305 | 2005-09-29 21:39:00 | OK I've found the following code, will this destoy the cookie though <?php session_start(); $_SESSION = array(); session_destroy(); ?> or would I have to add something like for my dBase @mysql_query("delete from cart_cookie where cookie_ID = '" . session_id() . "'"); but Would this prevent the same session being used again, after all the cookie would still exist with the session id in it |
Morgenmuffel (187) | ||
| 1 | |||||