Okay, I got a slight problem. I want to have a "Whos Online" script on my site, the only problem is that my site runs on Iframes, and the Online Script doesn't refresh, so the only way I could make it refresh was in a iframe (by refresh I don't want the WHOLE page to refresh, just the Whos online)
My problem is that if I try to put the online code in a iframe (that's the only way I know how to refresh) then the code does not work properly.
So, what I need is:
A Whos Online script that WILL work with my members system (I'll post the original code) AND works in an iframe.
OR
A script that refreshes the Whos Online script WITHOUT refreshing the whole page.
Any one will do!!!
The code below displays the users:
The code below updates the member and sets them as online and offline if after 30 seconds:
PLEASE AND THANK YOU!
~Keith.
My problem is that if I try to put the online code in a iframe (that's the only way I know how to refresh) then the code does not work properly.
So, what I need is:
A Whos Online script that WILL work with my members system (I'll post the original code) AND works in an iframe.
OR
A script that refreshes the Whos Online script WITHOUT refreshing the whole page.
Any one will do!!!
The code below displays the users:
| Code: |
| <?php
error_reporting(0); include("members/config.php"); include("members/online.php"); //get online configuration and such $get_online_users = mysql_query("SELECT * FROM `members` WHERE `online` >= '$offline' ORDER BY `userlevel` ASC"); //get all online users $total_users = mysql_num_rows($get_online_users); if($total_users == 0){ //see if anyone is logged in echo "No Users Online!"; //there isn't =O }else{ //maybe.... $i = 1; //the variable 'i' is 1 while($online = mysql_fetch_array($get_online_users)){ //loop online users if(($i > 0) && ($i != $total_users)){ //see if i is the same or not of total online users $comma = ', '; //if it isn't then theres a comma }else{ //or.... $comma = ''; //if there isn't theres no comma } //end check if($online['userlevel'] == 6) { echo "<a href='members/members.php?page=view&username=$online[username]' target='content'><font color='orange'>$online[username]</a>$comma"; //echo the online users with the comma } } //end loop } //end ?> <head> <meta http-equiv='Refresh' content='30; URL=online.php'/> <style> body { color: black; font-size: 10px; font-family: verdana; } </style> </head> |
The code below updates the member and sets them as online and offline if after 30 seconds:
| Code: |
| <?php
include('config.php'); $logout_time = 10; //mili seconds to stay logged in $current = time(); //current time $offline = ($current - $logout_time); //do the math for the logout time if($logged[username]){ //if they are logged in $update = mysql_query("UPDATE `members` SET `online` = '$current' WHERE `username` = '$logged[username]';"); //update their status } //end the check and such ?> |
PLEASE AND THANK YOU!
~Keith.
