In your current file,check whether the $_SESSION['id']
and $_SESSION['username']
are set or not. I yes, you can directly redirect the user to userpage.php
.
if($_SESSION['id'] != "" && $_SESSION['username'] != "")
{
header("location:userpage.php");
}
If you want to do this on checking “remember me”,you can use javascript or jquery.