Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP Help] How to make a online user list.

Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
Hi guys. I have a CMS what was made by someone and I added a guests online feature, my website contains a users online in game and a login area, I am now looking to make a online userlist for whos logged in and possible whos playing in game.. For example.. If AppleTree and PearTree is logged in it would show.. And I would like to be able to click them to go to there profile..

Heres how I would like my online section to look like..


8 Users Playing
2 Guests Online
0 WebUsers Online
2 Users Logged In
(AppleTree, PearTree)

1416 Accounts
1406 Characters
51 Guilds

25 Banned Hackers

Can anyone help me =]? Heres my website..

If you need to look at my php files PM me.
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
Dude don't you think I tried that? I woudn't ask here for help if I didn't already try that.. I asked at the other forum and I got flamed.. -_-.. I just want help to make this... If you have a link that would help me I searched hours and found nothing..
 
Joined
Sep 10, 2006
Messages
2,817
Reaction score
1,417
add to your sql table with columns username and time then place it on top of every your page so when someone browse your page and is logged in you add his name and time to the table you've made for it and on the same place make a query to delete all usernames with time -5 minutes.

so
PHP:
if($loggedin == true)
{
//add his name and time() to db
}
//and delete from table logged_users everyone who had no action for 5 minutes from that table
 
duck you, I'm a dragon
Loyal Member
Joined
Apr 29, 2005
Messages
6,407
Reaction score
130
Google, is your friend mate.

Honestly, get the duck out of here.

Anyway, it looks like you made a website for an online game. Most online games have a table called "users" or something, look in that table for a field where you can see if a user is online or not, it's usually called something like "loggedin" or "online"

Look for that field and post here if you found it.
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
Honestly, get the duck out of here.

Anyway, it looks like you made a website for an online game. Most online games have a table called "users" or something, look in that table for a field where you can see if a user is online or not, it's usually called something like "loggedin" or "online"

Look for that field and post here if you found it.

Yes, the field is called loggedin, As you can see I have how many people are online but I want it to display a list of members online and a list of members that are playing. Like on a forum at the bottom it says whos online, do you get what I mean?

@Fox I'm unsure what you mean that sentence got me even more confused now.. Could you rephrase that?..
 
Junior Spellweaver
Joined
Dec 2, 2006
Messages
198
Reaction score
0
ok. ill help you with me extreme expertise. rofl. haha.
PHP:
$table = "users"; //Name of table. Not sure about maplestory dbs. but change loggedin and table if it's wrong.
$query = mysql_query("SELECT * FROM $table WHERE loggedin = '1'") or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Users Online</th> </tr>";
    while($row = mysql_fetch_array( $query )) { 
	// Print out the contents of each row into a table
	echo "<tr><td>"; 
	echo $row['name'];
	echo "</td></tr>";
}
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
ok. ill help you with me extreme expertise. rofl. haha.
PHP:
$table = "users"; //Name of table. Not sure about maplestory dbs. but change loggedin and table if it's wrong.
$query = mysql_query("SELECT * FROM $table WHERE loggedin = '1'") or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Users Online</th> </tr>";
    while($row = mysql_fetch_array( $query )) { 
	// Print out the contents of each row into a table
	echo "<tr><td>"; 
	echo $row['name'];
	echo "</td></tr>";
}

Hi, I inputted it into my webpage and I get this error..
Code:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\Inetpub\vhosts\msblur.com\httpdocs\top.php on line 58

This is at line 58:
Code:
$table = "users"; //Name of table. Not sure about maplestory dbs. but change loggedin and table if it's wrong.

Code:
$result4 = mysql_query("SELECT * FROM accounts where banned = 1");// Account section
$num_rowsb = mysql_num_rows($result4);
$result5 = mysql_query("SELECT * FROM accounts where loggedin = 2");// Account section
$num_rowsl = mysql_num_rows($result5);
$result6 = mysql_query("SELECT * FROM accounts WHERE loggedin = 1 AND name != 'whatever ...' $orderby2 order by $orderby LIMIT $limit,25");// Character section

echo "
<b>".getOnline()."</b> WebUsers Online<br />
<b>".$num_rowsl."</b> Users Playing<br>

/////HERE IS WHERE I ADDED YOUR CODE////////////

$table = "accounts"; //Name of table. Not sure about maplestory dbs. but change loggedin and table if it's wrong.
$query = mysql_query("SELECT * FROM $table WHERE loggedin = '1'") or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Users Online</th> </tr>";
    while($row = mysql_fetch_array( $query )) { 
	// Print out the contents of each row into a table
	echo "<tr><td>"; 
	echo $row['name'];
	echo "</td></tr>";<br><br>

//////END OF YOUR CODE//////////////

<b>".$num_rows."</b> Accounts<br>
<b>".$num_rowsc."</b> Characters<br>
<b>".$num_rowsg."</b> Guilds<br><br>
<b>".$num_rowsb."</b> Banned Hackers<br>

";
?>
                                  <br>
                                  <?php
        echo $logserv_name;
        $fp = @fsockopen($serverip, $loginport, $errno, $errstr, 1);
	  if (!$fp) {
           echo $offline;

I added your code correctly but got this error.. my table is called accounts and has loggedin inside here also account name and other stuff, also will this list display their account name because I want it to display their profile name that they make on my site.

Sorry if I'm asking for a lot but I suck at php..
 
Junior Spellweaver
Joined
Dec 2, 2006
Messages
198
Reaction score
0
PHP:
$query = mysql_query("SELECT * FROM accounts WHERE loggedin = '1'") or die(mysql_error()); 
echo "<table border='1'>"; 
echo "<tr> <th>Users Online</th> </tr>"; 
    while($row = mysql_fetch_array( $query )) {  
    // Print out the contents of each row into a table 
    echo "<tr><td>";  
    echo $row['name']; 
    echo "</td></tr>"; 
}
if you want it to show a profile name. it could happen. but make sure they are in the same db. =]
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
I unfortunalty get the same error..

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\Inetpub\vhosts\msblur.com\httpdocs\top.php on line 57

Which is
PHP:
$query = mysql_query("SELECT * FROM accounts WHERE loggedin = '1'") or die(mysql_error());
again.. I think the problem is with the or die part... my top.php is shown on every page. I want the online users on the website which is why I want the profile part.. and I want them clickable to go to their character profile... And I want this again to go in the online in game which I want their character names showing.. Do you want FTP details? I'm finding this hard to explain =/.

Here I will post all of my php file code:

PHP:
<?php
session_start();
include("config.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE><?php echo $sitetitle; ?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="custom.js"></script>
</HEAD>
<BODY class="page">
                       <table width="990" border="0" cellspacing="0" cellpadding="0" align="left" height="100%">
                            <tr>
                                <td>
                         <table width="852" border="0" cellspacing="0" cellpadding="0" align="left" height="100%">
                            <tr>
                                <td colspan="3" valign="top" align="left"><a href="index.php"><img src="images/image/Logo1.png" border="0"></a><a href="introduction.php"><img src="images/image/New.png" border="0"></a></td>
                            </tr>
                            <tr>
                            <td valign="top" background="images/lnavbg.jpg" align="left" width="239" height="100%">

                            <table cellpadding="0" cellspacing="0" border="0">
                            <tr><td><img src="images/image/Left.gif"></td></tr>
                            <tr><td><img src="images/lnav1-1.jpg"><?php
                            if($_SESSION['id']){
								echo "<a href=\"community.php\"><img src=\"images/lnav1-21.jpg\" border=\"0\"></a><img src=\"images/lnav1-3.jpg\"><a href=\"logout.php\"><img src=\"images/lnav1-42.jpg\" border=\"0\"></a>";
							}else{
								echo "<a href=\"login.php\"><img src=\"images/lnav1-2.gif\" border=\"0\"></a><img src=\"images/lnav1-3.jpg\"><a href=\"register.php\"><img src=\"images/lnav1-4.jpg\" border=\"0\"></a>";
							}
							
							?><img src="images/lnav1-5.jpg"></td></tr>
                            <tr><td><img src="images/lnav2.jpg"></td></tr>
                            <tr><td><a href="download.php"><img src="images/lnav3-1.jpg" border="0"></a><img src="images/lnav3-2.jpg"></td></tr>
                            <tr><td><img src="images/lnav4.jpg"></td></tr>
                            <tr><td style="padding-left: 12px;">
                              
<br><br><!-- Start FreeOnlineUsers.com --> 
<font color=#000000><b><script type="text/javascript" src="http://freeonlineusers.com/on1.php?id=112421"> </script></b> Guests Online</font></a>
<!-- End FreeOnlineUsers.com --><br>
<?php
$result = mysql_query("SELECT * FROM accounts");// Account section
$num_rows = mysql_num_rows($result);
$result2 = mysql_query("SELECT * FROM characters");// Character section
$num_rowsc = mysql_num_rows($result2);
$result15 = mysql_query("SELECT * FROM guilds");// Character section
$num_rowsg = mysql_num_rows($result15);
$result4 = mysql_query("SELECT * FROM accounts where banned = 1");// Account section
$num_rowsb = mysql_num_rows($result4);
$result5 = mysql_query("SELECT * FROM accounts where loggedin = 2");// Account section
$num_rowsl = mysql_num_rows($result5);
$result6 = mysql_query("SELECT * FROM accounts WHERE loggedin = 1 AND name != 'whatever ...' $orderby2 order by $orderby LIMIT $limit,25");// Character section

echo "
<b>".getOnline()."</b> WebUsers Online<br />
<b>".$num_rowsl."</b> Users Playing<br><br>

//////////////////////////////////////////////////////////////////////////////////////////
///////////////////HERE IS WHERE I WANT YOUR CODE GOING//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////

<b>".$num_rows."</b> Accounts<br>
<b>".$num_rowsc."</b> Characters<br>
<b>".$num_rowsg."</b> Guilds<br><br>
<b>".$num_rowsb."</b> Banned Hackers<br>

";
?>
                                  <br>
                                  <?php
        echo $logserv_name;
        $fp = @fsockopen($serverip, $loginport, $errno, $errstr, 1);
	  if (!$fp) {
           echo $offline;
        } else {
           echo $online;
        }

        @fclose($fp);
        ?>
</td></tr>

                            </table>
                               </td>
                                <td valign="top" align="left"  background="images/cbg.jpg" width="612">
                                <table cellpadding="0" cellspacing="0" border="0"><tr><td width="611"><a href="index.php"><img src="images/image/Home.png" border="0"></a><a href="news.php"><img src="images/image/News.png" border="0"></a><a href="events.php"><img src="images/image/Events.png" border="0"></a><a href="register.php"><img src="images/image/Register.png" border="0"></a><a href="<?php echo $forumurl; ?>" target="_blank"><img src="images/image/Forum.png" border="0"></a><a href="ranking.php"><img src="images/image/Ranking.png" border="0"></a><a href="guilds.php"><img src="images/image/Guilds.png" border="0"></a></td></tr></table>
                                <div style="padding: 10px;">
                                <font size="1" color="#000000">

And yes the profile name is in the same database, its in table "web_profile" and the profile field name is "name". some people don't have profile names so will that just show their account name instead?
 
Junior Spellweaver
Joined
Dec 2, 2006
Messages
198
Reaction score
0
is that one top.php?
could you show that. it seems like your missing a ;
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
is that one top.php?
could you show that. it seems like your missing a ;
PHP:
<?php 
session_start(); 
include("config.php"); 
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<HTML> 
<HEAD> 
<TITLE><?php echo $sitetitle; ?></TITLE> 
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> 
<link href="style.css" rel="stylesheet" type="text/css"> 
<script type="text/javascript" src="custom.js"></script> 
</HEAD> 
<BODY class="page"> 
                       <table width="990" border="0" cellspacing="0" cellpadding="0" align="left" height="100%"> 
                            <tr> 
                                <td> 
                         <table width="852" border="0" cellspacing="0" cellpadding="0" align="left" height="100%"> 
                            <tr> 
                                <td colspan="3" valign="top" align="left"><a href="index.php"><img src="images/image/Logo1.png" border="0"></a><a href="introduction.php"><img src="images/image/New.png" border="0"></a></td> 
                            </tr> 
                            <tr> 
                            <td valign="top" background="images/lnavbg.jpg" align="left" width="239" height="100%"> 

                            <table cellpadding="0" cellspacing="0" border="0"> 
                            <tr><td><img src="images/image/Left.gif"></td></tr> 
                            <tr><td><img src="images/lnav1-1.jpg"><?php 
                            if($_SESSION['id']){ 
                                echo "<a href=\"community.php\"><img src=\"images/lnav1-21.jpg\" border=\"0\"></a><img src=\"images/lnav1-3.jpg\"><a href=\"logout.php\"><img src=\"images/lnav1-42.jpg\" border=\"0\"></a>"; 
                            }else{ 
                                echo "<a href=\"login.php\"><img src=\"images/lnav1-2.gif\" border=\"0\"></a><img src=\"images/lnav1-3.jpg\"><a href=\"register.php\"><img src=\"images/lnav1-4.jpg\" border=\"0\"></a>"; 
                            } 
                             
                            ?><img src="images/lnav1-5.jpg"></td></tr> 
                            <tr><td><img src="images/lnav2.jpg"></td></tr> 
                            <tr><td><a href="download.php"><img src="images/lnav3-1.jpg" border="0"></a><img src="images/lnav3-2.jpg"></td></tr> 
                            <tr><td><img src="images/lnav4.jpg"></td></tr> 
                            <tr><td style="padding-left: 12px;"> 
                               
<br><br><!-- Start FreeOnlineUsers.com -->  
<font color=#000000><b><script type="text/javascript" src="http://freeonlineusers.com/on1.php?id=112421"> </script></b> Guests Online</font></a> 
<!-- End FreeOnlineUsers.com --><br> 
<?php 
$result = mysql_query("SELECT * FROM accounts");// Account section 
$num_rows = mysql_num_rows($result); 
$result2 = mysql_query("SELECT * FROM characters");// Character section 
$num_rowsc = mysql_num_rows($result2); 
$result15 = mysql_query("SELECT * FROM guilds");// Character section 
$num_rowsg = mysql_num_rows($result15); 
$result4 = mysql_query("SELECT * FROM accounts where banned = 1");// Account section 
$num_rowsb = mysql_num_rows($result4); 
$result5 = mysql_query("SELECT * FROM accounts where loggedin = 2");// Account section 
$num_rowsl = mysql_num_rows($result5); 
$result6 = mysql_query("SELECT * FROM accounts WHERE loggedin = 1 AND name != 'whatever ...' $orderby2 order by $orderby LIMIT $limit,25");// Character section 

echo " 
<b>".getOnline()."</b> WebUsers Online<br /> 
<b>".$num_rowsl."</b> Users Playing<br>

/////////////////////////////////////////////////////////////////////////////
$query = mysql_query("SELECT * FROM accounts WHERE loggedin = '1'") or die(mysql_error()); 
echo "<table border='1'>"; 
echo "<tr> <th>Users Playing Now!</th> </tr>"; 
    while($row = mysql_fetch_array( $query )) {  
    // Print out the contents of each row into a table 
    echo "<tr><td>";  
    echo $row['name']; 
    echo "</td></tr>"; 
}
/////////////////////////////////////////////////////////////////////////////
<br><br>
<b>".$num_rows."</b> Accounts<br> 
<b>".$num_rowsc."</b> Characters<br> 
<b>".$num_rowsg."</b> Guilds<br><br> 
<b>".$num_rowsb."</b> Banned Hackers<br> 

"; 
?> 
                                  <br> 
                                  <?php 
        echo $logserv_name; 
        $fp = @fsockopen($serverip, $loginport, $errno, $errstr, 1); 
      if (!$fp) { 
           echo $offline; 
        } else { 
           echo $online; 
        } 

        @fclose($fp); 
        ?> 
</td></tr> 

                            </table> 
                               </td> 
                                <td valign="top" align="left"  background="images/cbg.jpg" width="612"> 
                                <table cellpadding="0" cellspacing="0" border="0"><tr><td width="611"><a href="index.php"><img src="images/image/Home.png" border="0"></a><a href="news.php"><img src="images/image/News.png" border="0"></a><a href="events.php"><img src="images/image/Events.png" border="0"></a><a href="register.php"><img src="images/image/Register.png" border="0"></a><a href="<?php echo $forumurl; ?>" target="_blank"><img src="images/image/Forum.png" border="0"></a><a href="ranking.php"><img src="images/image/Ranking.png" border="0"></a><a href="guilds.php"><img src="images/image/Guilds.png" border="0"></a></td></tr></table> 
                                <div style="padding: 10px;"> 
                                <font size="1" color="#000000">

Could you edit my top.php and show me what I missed? As I said I'm really bad with php coding..
 
Junior Spellweaver
Joined
Dec 2, 2006
Messages
198
Reaction score
0
PHP:
echo "  
<b>".getOnline()."</b> WebUsers Online<br />  
<b>".$num_rowsl."</b> Users Playing<br> 

///////////////////////////////////////////////////////////////////////////// 
$query = mysql_query("SELECT * FROM accounts WHERE loggedin = '1'") or die(mysql_error());  
echo "<table border='1'>";  
echo "<tr> <th>Users Playing Now!</th> </tr>";  
    while($row = mysql_fetch_array( $query )) {   
    // Print out the contents of each row into a table  
    echo "<tr><td>";   
    echo $row['name'];  
    echo "</td></tr>";  
} 
///////////////////////////////////
your echo is still going on. lol. haha.
 
Joined
Jul 26, 2006
Messages
3,634
Reaction score
1,007
I'm guessing you'll have something like a config.php which you include on EVERY page?
Well, in that config.php just add;
PHP:
//Connection to db must have been made above !
$update = mysql_query("UPDATE `USERS_TABLE` SET `last_online` = NOW() WHERE `username` = '". $sess_username_var ."' LIMIT 1");
if (!$update)
{
	die(mysql_error());
}

function show_online()
{
$sql = "SELECT `username` FROM `USERS_TABLE` WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) <= `last_online`";
//Change '5 MINUTE' to anything.
//5 MINUTE means that it'll display anyone online in the last 5 mins.
$query = mysql_query($sql);
$total = mysql_num_rows($query);

echo $total ."WebUsers Online<br />";
echo "(";
$i = 0;
while($row = mysql_fetch_array($query)) {
$i++;
if ($i == $total) {
echo $row['username']. "";
} else {
echo $row['username']. ", ";
}
}
echo ")";
}
!! In your DB make a row called 'last_online' !!
So to now show it, just in the HTML to <?=show_online();?>

I guess with that code you could make virtually anything.
 
Joined
Sep 10, 2006
Messages
2,817
Reaction score
1,417
I'm guessing you'll have something like a config.php which you include on EVERY page?
Well, in that config.php just add;
PHP:
//Connection to db must have been made above !
$update = mysql_query("UPDATE `USERS_TABLE` SET `last_online` = NOW() WHERE `username` = '". $sess_username_var ."' LIMIT 1");
if (!$update)
{
    die(mysql_error());
}

function show_online()
{
$sql = "SELECT `username` FROM `USERS_TABLE` WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) <= `last_online`";
//Change '5 MINUTE' to anything.
//5 MINUTE means that it'll display anyone online in the last 5 mins.
$query = mysql_query($sql);
$total = mysql_num_rows($query);

echo $total ."WebUsers Online<br />";
echo "(";
$i = 0;
while($row = mysql_fetch_array($query)) {
$i++;
if ($i == $total) {
echo $row['username']. "";
} else {
echo $row['username']. ", ";
}
}
echo ")";
}
!! In your DB make a row called 'last_online' !!
So to now show it, just in the HTML to <?=show_online();?>

I guess with that code you could make virtually anything.
That's kidnda what I meant, was just lazy to write the actual code.
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
Guys thanks for the help but I tried both of yours and I still get the error above.. Maybe there is something else wrong with my top.php.. I added a ; to the end of that echo and I still get that error.. Any help?

Elite GMs way doesn't show error but it doesn't work..

I put that code in config.php and put the <?=show_online();?> where I want the list going in top.php..

As I say I'm really bad with php.
 
Newbie Spellweaver
Joined
Jul 2, 2008
Messages
49
Reaction score
2
Guys thanks for the help but I tried both of yours and I still get the error above.. Maybe there is something else wrong with my top.php.. I added a ; to the end of that echo and I still get that error.. Any help?

Elite GMs way doesn't show error but it doesn't work..

I put that code in config.php and put the <?=show_online();?> where I want the list going in top.php..

As I say I'm really bad with php.
The thing is, you really shouldn't be echoing the result when the function does that already! On the other hand, you might not have short tags activated. Try replacing <?=show_online();?> with <?php show_online() ?>
 
Newbie Spellweaver
Joined
Jul 7, 2008
Messages
43
Reaction score
0
The thing is, you really shouldn't be echoing the result when the function does that already! On the other hand, you might not have short tags activated. Try replacing <?=show_online();?> with <?php show_online() ?>

That didn't work either.. I'll show you my config.php and top.php and can you correct me where I'm going wrong?

config.php

PHP:
<?php
session_start();
/* MySQL */
$host = "localhost"; /* your host - standard: localhost */
$user = "######"; /* your database user - standard: root */
$pass = "#####"; /* your database password - standard: root */
$database = "odinms"; /* your database name - standard: odinms */

$conn = mysql_connect($host,$user,$pass);
$db = mysql_select_db($database, $conn) or die(mysql_error());

$forumurl = "http://msblur.com/forum"; /* your forum url */
$sitetitle = "MSBlur v3.5";
$client = "http://msblur.com/MSBClientPack.zip"; /* URL to your client */
$servername = "MSBlur"; /* Name of your private server */
/* User online check */
if(isset($_SESSION['id'])){
	$logouttime = 300;
	$timenow = time();
	$loggedtime = $timenow - $logouttime;
	$query = mysql_query("UPDATE `accounts` SET `sitelogged` = '".$timenow."' WHERE `id`='".$_SESSION['id']."'") or die(mysql_error());
	$retrieve = mysql_query("SELECT * FROM `accounts` WHERE `sitelogged` >= '".$loggedtime."'") or die(mysql_error());
	$online = mysql_fetch_array($retrieve);
}


//Connection to db must have been made above !
$update = mysql_query("UPDATE `accounts` SET `last_online` = NOW() WHERE `name` = '". $sess_username_var ."' LIMIT 1");
if (!$update)
{
    die(mysql_error());
}

function show_online()
{
$sql = "SELECT `name` FROM `accounts` WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) <= `last_online`";
//Change '5 MINUTE' to anything.
//5 MINUTE means that it'll display anyone online in the last 5 mins.
$query = mysql_query($sql);
$total = mysql_num_rows($query);

echo $total ."WebUsers Online<br />";
echo "(";
$i = 0;
while($row = mysql_fetch_array($query)) {
$i++;
if ($i == $total) {
echo $row['username']. "";
} else {
echo $row['username']. ", ";
}
}
echo ")";
}  

/* Functions */
function getOnline(){
	$logouttime = 300;
	$timenow = time();
	$loggedtime = $timenow - $logouttime;
	$a = mysql_query("SELECT * FROM `accounts` WHERE `sitelogged` >= '".$loggedtime."'") or die(mysql_error());
	$b = mysql_num_rows($a);
	return $b;
}
function onlineCheck($string){
	$logouttime = 300;
	$timenow = time();
	$loggedtime = $timenow - $logouttime;
	$a = mysql_query("SELECT * FROM `accounts` WHERE `sitelogged` >= '".$loggedtime."' AND `id`='".$string."'") or die(mysql_error());
	$b = mysql_fetch_array($a);
	if($b['sitelogged'] >= $loggedtime){
		$check = "<img src=\"images/online.png\" height=\"13\" width=\"13\">";
	}else{
		$check = "<img src=\"images/offline.png\" height=\"13\" width=\"13\">";
	}
	return $check;
}
function getID($string){
	$a = mysql_query("SELECT * FROM `web_profile` WHERE `name`='".$string."'") or die(mysql_error());
	$b = mysql_fetch_array($a);
	return $b['accountid'];
}
function getName(){
	$a = mysql_query("SELECT * FROM `accounts` WHERE `id`='".$_SESSION['id']."'") or die(mysql_error());
	$b = mysql_fetch_array($a);
	return $b['name'];
}


?>

top.php

PHP:
<?php
session_start();
include("config.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE><?php echo $sitetitle; ?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="custom.js"></script>
</HEAD>
<BODY class="page">
                       <table width="990" border="0" cellspacing="0" cellpadding="0" align="left" height="100%">
                            <tr>
                                <td>
                         <table width="852" border="0" cellspacing="0" cellpadding="0" align="left" height="100%">
                            <tr>
                                <td colspan="3" valign="top" align="left"><a href="index.php"><img src="images/image/Logo1.png" border="0"></a><a href="introduction.php"><img src="images/image/New.png" border="0"></a></td>
                            </tr>
                            <tr>
                            <td valign="top" background="images/lnavbg.jpg" align="left" width="239" height="100%">

                            <table cellpadding="0" cellspacing="0" border="0">
                            <tr><td><img src="images/image/Left.gif"></td></tr>
                            <tr><td><img src="images/lnav1-1.jpg"><?php
                            if($_SESSION['id']){
								echo "<a href=\"community.php\"><img src=\"images/lnav1-21.jpg\" border=\"0\"></a><img src=\"images/lnav1-3.jpg\"><a href=\"logout.php\"><img src=\"images/lnav1-42.jpg\" border=\"0\"></a>";
							}else{
								echo "<a href=\"login.php\"><img src=\"images/lnav1-2.gif\" border=\"0\"></a><img src=\"images/lnav1-3.jpg\"><a href=\"register.php\"><img src=\"images/lnav1-4.jpg\" border=\"0\"></a>";
							}
							
							?><img src="images/lnav1-5.jpg"></td></tr>
                            <tr><td><img src="images/lnav2.jpg"></td></tr>
                            <tr><td><a href="download.php"><img src="images/lnav3-1.jpg" border="0"></a><img src="images/lnav3-2.jpg"></td></tr>
                            <tr><td><img src="images/lnav4.jpg"></td></tr>
                            <tr><td style="padding-left: 12px;">
                              
<br><br><!-- Start FreeOnlineUsers.com --> 
<font color=#000000><b><script type="text/javascript" src="http://freeonlineusers.com/on1.php?id=112421"> </script></b> Guests Online</font></a>
<!-- End FreeOnlineUsers.com --><br>
<?php
$result = mysql_query("SELECT * FROM accounts");// Account section
$num_rows = mysql_num_rows($result);
$result2 = mysql_query("SELECT * FROM characters");// Character section
$num_rowsc = mysql_num_rows($result2);
$result15 = mysql_query("SELECT * FROM guilds");// Character section
$num_rowsg = mysql_num_rows($result15);
$result4 = mysql_query("SELECT * FROM accounts where banned = 1");// Account section
$num_rowsb = mysql_num_rows($result4);
$result5 = mysql_query("SELECT * FROM accounts where loggedin = 2");// Account section
$num_rowsl = mysql_num_rows($result5);
$result6 = mysql_query("SELECT * FROM accounts WHERE loggedin = 1 AND name != 'whatever ...' $orderby2 order by $orderby LIMIT $limit,25");// Character section

echo "
<b>".getOnline()."</b> WebUsers Online<br />
<b>".$num_rowsl."</b> Users Playing<br>
<br>

<?php show_online() ?>

<b>".$num_rows."</b> Accounts<br>
<b>".$num_rowsc."</b> Characters<br>
<b>".$num_rowsg."</b> Guilds<br><br>
<b>".$num_rowsb."</b> Banned Hackers<br>

";
?>

<div id="content">
      <div id="column1">
			<div class="sidebaritem" style="width:168px; color:black;">
	Server Status
	<p><?php include('functions\functions.php'); echo "Login Server: ".$login_status; ?></p>
	<p><?php echo "World Server: ".$world_status; ?></p><br>

</div>
</div>

                                <?php
        echo $logserv_name;
        $fp = @fsockopen($serverip, $loginport, $errno, $errstr, 1);
	  if (!$fp) {
           echo $offline;
        } else {
           echo $online;
        }

        @fclose($fp);
        ?>  
                               
</td></tr>

                            </table>
                               </td>
                                <td valign="top" align="left"  background="images/cbg.jpg" width="612">
                                <table cellpadding="0" cellspacing="0" border="0"><tr><td width="611"><a href="index.php"><img src="images/image/Home.png" border="0"></a><a href="news.php"><img src="images/image/News.png" border="0"></a><a href="events.php"><img src="images/image/Events.png" border="0"></a><a href="register.php"><img src="images/image/Register.png" border="0"></a><a href="<?php echo $forumurl; ?>" target="_blank"><img src="images/image/Forum.png" border="0"></a><a href="ranking.php"><img src="images/image/Ranking.png" border="0"></a><a href="guilds.php"><img src="images/image/Guilds.png" border="0"></a></td></tr></table>
                                <div style="padding: 10px;">
                                <font size="1" color="#000000">

..?
 
Back
Top