Ik probeer dus mijn online gebruikers lijst in de sidebar te laten auto-refreshen maar ik ben nogal een noobie op het vlak van javascript.
En het lukt me dus niet.
De Sidebar.php code:
<div class="right_block Sidebar_right">
<div class="content">
<p id="online"></p>
<script>
setInterval(function() {online()},150);
function online() {
y=Er zijn: <a href="online_users.php"><font color="#00FF26"><?php echo count_onlineusers(); ?> gebruikers Online</font></a>;
document.getElementById("online").innerHTML=y;
}
</script>
<?php
// Query the posts table for all posts in the specified topic
$sql2 = "SELECT * FROM users WHERE TIMESTAMPDIFF(SECOND,`last_Active`,NOW()) <= 15 LIMIT 50";
// Execute the SELECT query
$res2 = mysql_query($sql2) or die(mysql_error());
// Fetch all the post data from the database
while ($row2 = mysql_fetch_assoc($res2)) {
// Echo out the topic post data from the database
?> <div id='onlineusers'></div>
<script>
setInterval(function() {reloader()},150);
function reloader(){
y=<?php echo "<a href='profile.php?username=".$row2['username']."'><img src='".getavatar($row2['id'])."' Title='".$row2['username']."' style='width:30px;height:30px;'></a>"; ?>;
document.getElementById('onlineusers').innerHTML=y;
}
</script> <?php
}
?>
<p>Er zijn: <a href="allusers.php"><?php echo count_registered(); ?> geregistreerden</a></p>
<div style="visibility: hidden">
<!-- START OF HIT COUNTER CODE -->
<br><script language="JavaScript" src="http://www.counter160.com/js.js?img=11"></script><br><a href="http://www.000webhost.com"><img src="" alt="Free web hosting" border="0" align="texttop"></a><a href="http://www.hosting24.com"><img alt="Web hosting" src="" border="0" align="texttop"></a>
<!-- END OF HIT COUNTER CODE -->
</div>
</div>
</div>
<div class="background Body"></div>
<div class="Main">
<div id="wrapper">
<div class="content">Met vriendelijke Groetjes,
Jasper D.,