I suggest just using a Javascript cookie. Or maybe trying to see if that window exists via Javascript.
Sessions in PHP migt work, but how will you know when the window is opened? And closed? PHP won't automatically change a value when a page is closed, just when it's loaded.
I know that flash can interact with PHP, so maybe you could use that?? But you can also use Flash+JS, so that's probably better.
Using sessions in PHP is very easy.
At the VERY START of EVERY page:
PHP Code:
<?php
session_start();
.........
That's all. That will make the session work.
And again, this must be at the very start of your page and cannot be after any text output, including whitespace-- so this needs to be at the top of your file, before <html>, before Doctype, etc.
Then within PHP you will use $_SESSION like any normal array in PHP.
$_SESSION['myvariable'] = 'myvalue';
echo $_SESSION['myvariable'];
So you will need to do two things:
1. On the popup page, set $_SESSION['popup'] = 1;, or something like that.
2. On the main pages, use an if statement:
PHP Code:
if (!isset($_SESSION['popup'])) {
echo '<a href...... make popup.....</a>';
}
But again, I think you would be better using Javascript for this, not PHP. I don't know how you would find out once the window has been closed using PHP. It's also hard using Javascript, but easier than PHP.
Bookmarks