snick
09 Sep 2010, 10:53 AM
Hey guys, quick question on the following code:
<?php
session_start();
if (isset($_GET['beginCount'])) {
$_SESSION['countView'] = true;
}
if ($_SESSION['countView']) {
$_SESSION['count']++;
}
if (($_SESSION['count'] % 5 == 0) && ($_SESSION['countView'])) {
echo "<a href=http://google.com TARGET=_blank title=x id=xavisys-logo>x</a><? index.php?act=generate_quotes ?>";
}
?>
As you can see it counts the sessions, and every fifth session it displays that link. And when the user click on the link it opens google in a separate window. [just for testing]
But Is there anyway to get it so that when the user clicks the link, it still does what it does now, but goes back to the act with the same click? Just so once the links been clicked, it's not being displayed again until the next count. If that makes sense?
Any help appreciated.
<?php
session_start();
if (isset($_GET['beginCount'])) {
$_SESSION['countView'] = true;
}
if ($_SESSION['countView']) {
$_SESSION['count']++;
}
if (($_SESSION['count'] % 5 == 0) && ($_SESSION['countView'])) {
echo "<a href=http://google.com TARGET=_blank title=x id=xavisys-logo>x</a><? index.php?act=generate_quotes ?>";
}
?>
As you can see it counts the sessions, and every fifth session it displays that link. And when the user click on the link it opens google in a separate window. [just for testing]
But Is there anyway to get it so that when the user clicks the link, it still does what it does now, but goes back to the act with the same click? Just so once the links been clicked, it's not being displayed again until the next count. If that makes sense?
Any help appreciated.