Okay, hi.
So in the code i have below i'm using an if statement to check if the user is an administrator, but the problem is that it doesn't check it, it doesn't even call it and in the console it says: "Uncaught SyntaxError: Unexpected token <". I'm guessing that it executes the PHP code instantly, but that's not what i want, i just want it to put it into the div. (And since it checks the session, it should work, since i've already checked if session contains those things about the div.)
Code:
for (var x = 0; x < commentData.length; x++) {
if(x!=(commentData.length-1)) {
var commentSubData = commentData[x].split("^");
commentDIV = commentDiv+"<p style='display:block'><font size='4' color='white'>"+commentSubData[(x+3)]+"</font><br><br><font size='2' color='lightgray'>Posted on <font color='lightblue'>"+commentSubData[(x+2)]+"</font> by <font color='lightblue'>"+commentSubData[(x+1)]+"</font></font>
<?
if($poster == $_SESSION['user_forumname'] || $_SESSION['perm_removecomments'] == 1) {
?>
<font color='red'><a onclick='dialog(<?=$post_id;?>, "+commentSubData[(x+0)]+")' title='Remove'><span class='glyphicon glyphicon-remove'></span></a></font>
<?
}
?>
</p>
<hr>";
}
}