Question: i want to generate loop of javascript in php which give me syntax error.here is what i want

```
var d1 = [
          [(new Date("01/06/2013")). getTime(),4],
          [(new Date("01/07/2013")). getTime(),0],
         ];

```

i want to make it dynamic from db.here is what i tried

```
var d1 = [
<?php
    while($rw = $oAppl->row($res))
    {
        $php_var = $rw['list_date_rent'];
        $php_var2 = $rw['rntval'];
?>            
    var php_var = "<?php echo $php_var; ?>";
    var php_var2 = "<?php echo $php_var2; ?>";
    [(new Date("+'"php_var"'+")). getTime(),php_var2],
<?php
    }
?>
];

```

Answer: 
You don't need to explicitly delete the `JSESSIONID` cookie like this. It is not managed by Spring Security as such, but by your servlet container. Spring Security will by default invalidate the http session upon logout, which in turn causes your servlet container to remove the `JSESSIONID` cookie.
How to delete on log-out is straightforward:
you implement logout and put that code in the method:

```
    HttpSession session = request.getSession(false); 
    if (session != null) { 
       session.invalidate();
    }

```

Invalidated session will make the cookie invalid.

But I tried and found, that when I close the browser without logout, the JSESSIONID cookie survives and user able enter the system , when opens the browser.

To eliminate this I created a filter, that invalidates the session on login too, creating a new session, where your login will be performed from start.

```
@WebFilter(urlPatterns = {"/login/*"}, description = "sessionKiller", filterName="sessionKiller")
public class SessionKillerFilter implements Filter{

    @Override
    public void init(FilterConfig arg0) throws ServletException {}

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        //kill older session and create new one on explicit login
        //this is to prevent user to login 2-ce
        //also this is prevention of re-connect on cookie base, when browser closed and then open
        HttpServletRequest  request = (HttpServletRequest)req;
        HttpSession session =   request.getSession(false);
        if(session!=null){
            session.invalidate();//old session invalidated
        }
        request.getSession(true);//new session created

        chain.doFilter(req, resp);
    }

    @Override
    public void destroy() {}
}

```