detecting refresh browser activity in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nirma78
Forum Commoner
Posts: 42
Joined: Wed Sep 17, 2003 2:02 pm

detecting refresh browser activity in PHP

Post by nirma78 »

Hi

I am working on a web application using PHP and Oracle.

I would like to know is there any way we can detect if the back browser button is clicked or the refresh browser button is clicked ???


Any help on this is appreciated.
Thanks in advance
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

<?php
if(!isset($_SESSION['bla']))
{
$_SESSION['bla'] = 1;
}
else
{
$_SESSION['bla']++;
}
?>
i would use sessions, for example, when the page is loaded the first time $_SESSION['bla'] is set to 1, if the user reloads the page then it would add 1 to its value, after that you can use soemthing like

Code: Select all

<?php
if($_SESSION['bla'] != 1))
{
//your code here
}

?>
you can do the same with cookies by the way :wink:.
nirma78
Forum Commoner
Posts: 42
Joined: Wed Sep 17, 2003 2:02 pm

Post by nirma78 »

Thanks will try it out !!
Post Reply