mii mii - 7 days ago 6
PHP Question

Echo text after an amount of time

Hello im trying to make a logout session.. my problem is that its not visible if im logged out or not after an amount of time so im trying to write out a text to let the user now its logged out..
As i understood from now i do not get logged out until i update my site again, so i want to echo out the text without updating my site.. is this possible?!

Here is my homemade code

if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 20)) {
include("logout.php");
echo "you have been logged out";
}
$_SESSION['LAST_ACTIVITY'] = time();
}


My logout.php aswell

session_start();
session_destroy();
header("Location:index.php");


Some help and advice would be great!

mii mii
Answer

Hello again I was able to solve my problem. I post my solution here for other people.. The problem was easier than i thought all i did was to get the logout session and append a "text" or in the case a picture after an amout of time...

setTimeout(picture, 3000);

function picture(){
    $.get("logout.php");
    $("body").append('<img src="boll.gif" id = "boll">');
}
Comments