I seem to be getting these two errors regarding my
Notice: undefined variable: user in C:\xampp\htdocs\Index.php on line 4
Fatal error: Call to a member function is_loggedin() on null in C:\xampp\htdocs\Index.php on line 4
The error says that the user variable is null. The issue seems to be that the user variable is not declared in scope of this function. I.e. in index.php
Another possibility is that you have not handled the condition where the user variable is going to be null.
If the first one is the case, make sure that the user variable is declared and assigned with the user properties.
If the second one is the case. Check the variable for null and redirect to login when the user is null.