How can I unset the SESSION
when I close the page by clicking [x] (not onunload
).
I want to insert when opening the page and when closing, but I don't want to insert when refreshing.
if (!isset($_SESSION["visits"]))
$_SESSION["visits"] = 0;
$_SESSION["visits"] = $_SESSION["visits"] + 1;
if ($_SESSION["visits"] > 1){echo "You hit the refresh button!";}
else{
mysql_query(
"INSERT INTO najd_visit( visit_userId, visit_staticId, visit_page,
visit_enterTime)VALUES ('$userId', '$Sid', '$title', '$date') ");
echo "This is my site";
//unset($_SESSION["visits"]);
}