Hey, this is very simple, and i'm here to help!
1st off, add this into your members table, or users (whatever you use.)
Online - Varchar(255) default: No
- Next, you're going to create a new file named online.php, or usersonline.php, whatever your heart desires to name it
<b>Online Users:</b><BR>
<table border='0' style='border-collapse: collapse' width='100%' id='table1'>
<tr>
<td width='33%' bgcolor='<?=$bgcolor?>' align=''><b>Username</b></td>
</tr>
</table>
<table border='0' style='border-collapse: collapse' bgcolor="black" width='100%' id='table2'>
<tr>
<td width="100%"> <table border='1' style='border-collapse: collapse' width='100%' id='table2'>
<?php include("database_connect.php");
// add a mysql query to gather all the users whos online = Yes.
echo "<ol>";
$result = mysql_query("SELECT * FROM members WHERE online = 'Yes' ");
while ( $online = mysql_fetch_array($result) ) {
$counter++;
// have it show up to 99999999999999 on one page.
if ($counter > 99999999999999) { break; }
if ( $counter % 2 == 0 ) {
$bgcolor="#bgcolorofyourchoice";
} else {
$bgcolor="#bgcolorofyourchoice";
}
?>
<tr>
<td width='33%' bgcolor='<?=$bgcolor?>' align=''><a href="link=<?=$online['id']?>"><?=$online['username']?></a></td>
</tr>
<?php
} echo "</ol>";
?>
</table></td>
</tr>
</table>
- <b>Online Users:</b><BR>
- <table border='0' style='border-collapse: collapse' width='100%' id='table1'>
- <tr>
- <td width='33%' bgcolor='<?=$bgcolor?>' align=''><b>Username</b></td>
- </tr>
- </table>
- <table border='0' style='border-collapse: collapse' bgcolor="black" width='100%' id='table2'>
- <tr>
- <td width="100%"> <table border='1' style='border-collapse: collapse' width='100%' id='table2'>
- <?php include("database_connect.php");
- // add a mysql query to gather all the users whos online = Yes.
- echo "<ol>";
- $result = mysql_query("SELECT * FROM members WHERE online = 'Yes' ");
- while ( $online = mysql_fetch_array($result) ) {
- $counter++;
- // have it show up to 99999999999999 on one page.
-
- if ($counter > 99999999999999) { break; }
- if ( $counter % 2 == 0 ) {
- $bgcolor="#bgcolorofyourchoice";
- } else {
- $bgcolor="#bgcolorofyourchoice";
- }
- ?>
- <tr>
- <td width='33%' bgcolor='<?=$bgcolor?>' align=''><a href="link=<?=$online['id']?>"><?=$online['username']?></a></td>
- </tr>
- <?php
- } echo "</ol>";
- ?>
- </table></td>
- </tr>
- </table>
- Thirdly, your going to need to add a mysql_query to your login page, and your logout page.
mysql_query("update members set online = 'No' where id = '$view[id]'") or die ("error: " . mysql_error()); // will update it when user logs out.
mysql_query("update members set online = 'Yes' where id = '$view[id]'") or die ("error: " . mysql_error()); // will update it when user logs in.
thats basically it, accept you chage everything so it will fit your coding needs/sql

oh, and the view[id] needs to be changed to whatever you use for that aswell.

Good luck, I hope this helps! (I tried to explain the best I could.)
again, good luck in creating this, and I hope this works for you!. If you have a question, just ask
