I already had some research and i found a functional code to logout upon inactivity, but my problem is i still need to refresh my browser inorder to prompt my alert function to be able to logout it. I want a code function that will automatically log you out even if you won't do anything. BTW this is my code.
<?php
if (time() - $_SESSION['timestamp'] > 30) {
?>
<script type="text/javascript">
alert("You Have Been inactive for 30 seconds");
window.location.href = "logout.php"; //To my logout function
</script>
<?php
} else {
$_SESSION['timestamp'] = time(); //set new timestamp
}
?>