javascript - php & js: can't delete cookie -


can please tell me why both php , javascript versions can't delete cookie target of script named "t"?

(no httponly, , has been created via js btw)

<?php     include('functions.php');     sec_session_start();     $lang = check_lang();     include("../config/lang/".$lang.".php");      // unset session values     $_session = array();      // session parameters      $params = session_get_cookie_params();      // delete actual cookie.     setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);     setcookie('t',"",-3600); //<-- 1 doesn't work)      // destroy session     session_destroy();      echo "<script language='javascript'>         function del_cookie(name) {             document.cookie = name + '=; expires=thu, 01-jan-70 00:00:01 gmt;';         }          del_cookie('t'); //<-- 1 neither.         </script>         <h1>$l[logout_ok]</h1>"; ?> 

i point http://ca3.php.net/manual/en/function.setcookie.php, part says: "expire: time cookie expires. unix timestamp in number of seconds since epoch." can't give negative value, part says: "if set 0, or omitted, cookie expire @ end of session."

just use setcookie("t", "", false), , done. cookie unset next request made browser server (be real pageload, or ajax request). said, cookies relevant during http request phase, shouldn't using them other set values server needs know across multiple requests. don't use them things happen on page (and consequently, don't try manipulate them through javascript, that's not they're relevant).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -