I have a webapp that uses login/logouts so I have session management. Basically every page so far starts with
session_start();
if(!isset($_SESSION['username'])) {header("Location: index.php");} else { rest of the page's functionality}
I am now creating a class (User.php); that will be accessed by another .php page. Do I need to implement the above for security, and if so how? Should I put classes above the webroot? Thanks