Just so you know here is the script I am trying to run:
<?php
session_start();
if(!session_is_registered("auth")) {
echo "<meta http-equiv='refresh' content=0;url='index.php?page=login'>";
exit;
}
?>
I realised that I could just use the http redirect even though this may not be the best way but I still have the problem with the session not working because of it being written after html has already been written by the template and if I put it into the main template file it just ends up in a loop of sending itself back to the same page as index.php is the main file.