i was wondering if there is a way in php to figure out if the page was refreshed or it came from another page?
Can PHP know when a page is refreshed?
Collapse
X
-
-
Good one ronnil! Thanks for posting, I hope to see you around here more often!Originally posted by ronnilsomething like this
Don't think there's a problem with $_GET data, but not sureCode:<?php if($_SERVER['HTTP_REFERER'] != $_SERVER['SCRIPT_URI']) { //This page was loaded from another page } else { //The page loaded itself } ?>Comment
-
i still can't get it to work. if it is redirected by another page i go my tasks and set [PHP]$_SERVER["HTTP_REFER ER"] = "";[/PHP]
but that doesn't work, cuz when i hit refresh the server overwrites it and sets it back to the value indicating that it came from another page once again.
how can i counter this?Comment
-
A quick and dirty solution would be to set the current page in a session variable. At the load of each page, make sure that the referer and that session variable match, then set the session variable again. This will not work for pages that link to themselves though.Originally posted by epots9i still can't get it to work. if it is redirected by another page i go my tasks and set [PHP]$_SERVER["HTTP_REFER ER"] = "";[/PHP]
but that doesn't work, cuz when i hit refresh the server overwrites it and sets it back to the value indicating that it came from another page once again.
how can i counter this?Comment
Comment