• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Search | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

On window.closed change cookie value, PHP?

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
Nedzad
Just Arrived
Just Arrived


Joined: 20 Nov 2009
Posts: 1


Offline

PostPosted: Thu Sep 30, 2010 10:34 pm    Post subject: On window.closed change cookie value, PHP? Reply with quote

Hi all,
On window open i start session and set cookie value. When i click on link it works, variable is changing. Now how can i change variable when window is closed. I know when browser is closed session is destroyed automatically.
As I said, on window open I start session end listen if value is changed.
Code:

session_start();
if(isSet($_GET['var']))
{
$var= $_GET['var'];

// register the session and set the cookie
$_SESSION['var'] = $var;

setcookie("var", $var, 0);
}
else if(isSet($_SESSION['var']))
{
$var= $_SESSION['var'];
}
else if(isSet($_COOKIE['var']))
{
$var= $_COOKIE['var'];
}
else
{
$var= 'something';
}

Now example when on click on link var will change:
Code:

 <a href="index.php?var=somethingElse">Link</a>

This is working.
Now i wanna change var when window is closed. I try something like this, but no result:

Code:

<script language="javascript" type="text/javascript">
if(window.closed ){
<?php $var='something';?> // :S this has nothing to do with cookie?
}
</script>

I did some research, but nothing spec. Pls help! Very Happy .
Thanks in advance!
Back to top
View user's profile Send private message
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Community Area

Log in | Register