I am using the session to show some text. The result I want is After 10s
of logging it should echo some text
.
I tried:-
Functions.php
function LoginSessionExpired() {
if(!isset($_SESSION['first_visit']))
{
$_SESSION['first_visit']=time();
}else{
$login_session_durations = 10;
if(isset($_SESSION['loggedin_time']) and isset($_SESSION["user_id"])){
if(((time() - $_SESSION['first_visit']) > $login_session_durations)){
return true;
}
}
}
}
Dashboard.php
session_start();
include("functions.php");
if(isset($_SESSION["user_id"])) {
if(LoginSessionExpired()) {
echo "Ok";
}
}
But it echoes
only when the page is refreshed, I want the auto show without refreshing.