akash_msrit 0 Light Poster

hi friends ,

i made a login page, and i made a logout button too, but i want to make a timed logout, i mean after 5 min for example the user is logout automatically.(i.e i should log out from inactive web page after 5 mins)

need source code or suggestions for this task
source code for loging out:

<?php
   session_start();
   unset($_SESSION['user']);
   if (isset($_COOKIE[session_name()])) {
       setcookie(session_name(), '', time()-42000, '/');
   }      
   $_SESSION = NULL;
   $_SESSION['user']=NULL;
   session_destroy();
   header("Location: index.php");
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.