I'm getting an 'unexpected end of file error' on this page. I know that this error is usually caused by a missed bracket somewhere but I can't for the life of me, after an hour of trying figure out what specifically is causing the problem. Would be very appreciative if anyone has the time to have a look through and see if they can spot something I couldn't. Thanks in advance :)
<?php
if(!isset($_SESSION['permAuth'])) {
?>
<script>
window.location.replace('index.php');
</script>
<?php
} else {
$level_sql="SELECT * FROM perms WHERE permLog=".$_SESSION['permAuth'];
$level_query=mysqli_query($dbconnect, $level_sql);
$level_rs=mysqli_fetch_assoc($level_query);
if($level_rs['permAccess']=='0') {
?>
<script>
window.location.replace('index.php');
</script>
<?php
}
include("links.php");
//Fetch all comments from the database
$comment_sql="SELECT * FROM comments ORDER BY commentID DESC LIMIT 8";
$comment_query=mysqli_query($dbconnect, $comment_sql);
$comment_rs=mysqli_fetch_assoc($comment_query);
?>
<div class="commentDisplayContainer2">
<?php
//Stop site trying to display comments if none exist
if(mysqli_num_rows($comment_query)==0) {
?><p>Sorry! No commments to display at this time</p>
<?php } else {
do {
?><div class="commentDisplayDiv2">
<p><?php echo $comment_rs['commentID']; ?> - <?php echo $comment_rs['commentLog']; ?></p>
<p><?php echo $comment_rs['commentText']; ?></p>
</div>
<?php
} while ($comment_rs=mysqli_fetch_assoc($comment_query));
}
include("usercomment2.php");
?>
</div>