session_start(); if ($_COOKIE(session_name() && !count($_SESSION)) { print "session has expired"; exit; } elsif (!$_COOKIE(session_name()) { print "You need to login first"; exit; } else { print "welcome back...."; ....