Hi!

How can I, from PHP, prevent a window to be closed? I mean, if certain condition is met (a cookie exists for instance) write some javascript or whatever to prevent the browser to be closed before some action is executed...

Code:
If(cookie)
   do not allow window to be closed because session details gotta be saved to a DB before that;
else
  Go ahead, close it!;