otuatail Posted July 1, 2015 Share Posted July 1, 2015 <?php // Library SMS3S Version 1.0.0 15-03-2014 Desmond O'Toole. require("../secure/SecureFunctions.php"); $page = "Admin"; session_start(); . . . if($_SESSION["current_page"] <> $page) { StoreData($page); mailtoX($page,"Library Admin Login.",""); } $_SESSION["current_page"] = $page; ======================== The idea is that current session only changes when a user goes from page to page. But if I hit F5 I get another log StoreData(). But the session should prevent this. Hi I have a db log that records the pages that a user visits. I don't want a repeat log if they hit F5 This is what I have been trying... Quote Link to comment https://forums.phpfreaks.com/topic/297141-logging-the-web-pages-of-a-visitor/ Share on other sites More sharing options...
scootstah Posted July 1, 2015 Share Posted July 1, 2015 Your code works for me. Try dumping your session to see if it is working properly. Right underneath session_start();, add: var_dump($_SESSION);It should be empty the first time, and then contain the current page after a refresh. Quote Link to comment https://forums.phpfreaks.com/topic/297141-logging-the-web-pages-of-a-visitor/#findComment-1515381 Share on other sites More sharing options...
QuickOldCar Posted July 1, 2015 Share Posted July 1, 2015 You could get more advanced with this and store into a database, set a unique for possibly date,ip,username,page or whatever you desire. Quote Link to comment https://forums.phpfreaks.com/topic/297141-logging-the-web-pages-of-a-visitor/#findComment-1515420 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.