ob_start(); session_start(); // Use session variable on this page. This function must put on the top of page. if(!session_is_registered("admin")){ // if session variable "username" does not exist. header("location:index.php"); // Re-direct to index.php } ?>