Server Status |CMS| problems
I am currently using GoldenShit CMS by samus, and am having a few problems with the server status. It keeps track of accounts, characters and online and such fine. My problem is the online/offline notice. Whether my server is offline or online, it always says offline. here is the status script:
PHP Code:
<div id="stactics">
<div id="staticstext">
<table align="center" width="90%" cellpadding="0" cellspacing="3" border="0" style="font-family: 'Calibri', Verdana, sans-serif; font-size: 12px; text-shadow: #ffffff 0px 1px 1px; font-size: 16px; margin-bottom: 15px">
<tr>
<td align="left">
Online:
</td>
<td align="right">
<?php
$checkaccs = mysql_query("SELECT * FROM accounts");
$checkchars = mysql_query("SELECT * FROM characters");
$checkbanned = mysql_query("SELECT * FROM accounts where banned = 1");
$accounts = mysql_num_rows($checkaccs);
$characters = mysql_num_rows($checkchars);
$banned = mysql_num_rows($checkbanned);
include('ConfigShit/init.php');
$database->query("SELECT * FROM gold_logs ORDER BY time DESC LIMIT 1");
if ($result = $database->fetch_next()) {
date_default_timezone_set('America/New_York');
if ((time() - strtotime($result['time']) > 60 * 3)) {//Check every 3 minutes
$doagain = true;
$database->query("SELECT count(*) as onlinecount FROM accounts WHERE loggedin = 2");
$row = $database->fetch_next();
$loggedin = (string) $row['onlinecount'];
} else {
$doagain = false;
$loggedin = (string) $result['onlineplayers'];
}
} else {
$doagain = true;
$database->query("SELECT count(*) as onlinecount FROM accounts WHERE loggedin = 2");
$row = $database->fetch_next();
$loggedin = (string) $row['onlinecount'];
}
echo $loggedin;
?>
</td>
</tr>
<tr>
<td align="left">
Status:
</td>
<td align="right">
<?php
if ($doagain) {
$fp = @fsockopen(SERVER_IP, LOGIN_PORT, $errno, $errstr, 1);
} else {
$fp = $result['online'];
}
if (!$fp) {
$isonline = 0;
$t = "<font color='#c80000'><u>Offline</u></font>";
}else{
$isonline = 1;
$t = "<font color='#1ec800'><u>Online</u></font>";
}
echo $t;
if ($doagain) {
$database->query("INSERT INTO gold_logs (time, onlineplayers, online) VALUES ('".date('Y-m-d H:i:s', time())."', ".$loggedin.", ".$isonline.")");
@fclose($fp);
}
?>
</td>
</tr>
<tr>
<td colspan="2"><img src="./images/sprtr.png"></td>
</tr>
<tr>
<td align="left">
Exp rate:
</td>
<td align="right">
<?php echo $e_rate; ?>
</td>
</tr>
<tr>
<td align="left">
Meso rate:
</td>
<td align="right">
<?php echo $m_rate; ?>
</td>
</tr>
<tr>
<td align="left">
Drop rate:
</td>
<td align="right">
<?php echo $d_rate; ?>
</td>
</tr>
<tr>
<td colspan="2"><img src="./images/sprtr.png"></td>
</tr>
<tr>
<td align="left">
Version:
</td>
<td align="right">
<?php echo $version; ?>
</td>
</tr>
<tr>
<td align="left">
Accounts:
</td>
<td align="right">
<?php echo $accounts; ?>
</td>
</tr>
<tr>
<td align="left">
Characters:
</td>
<td align="right">
<?php echo $characters; ?>
</td>
</tr>
<tr>
<td align="left">
Banned:
</td>
<td align="right">
<?php echo $banned; ?>
</td>
</tr>
</table>
</div>
<div id="footer">
Copyright Ā© <?php echo $servername;?> || Coded & Designed by Samus
</div>
</div>
Now if it matters, here is my Config:
PHP Code:
<?php
$servername = "GoldenShit CMS";
$host['hostname'] = 'localhost'; // Host name (127.0.0.1/localhost or IP)
$host['user'] = 'root'; // DB Username
$host['password'] = ''; // DB Password
$host['database'] = 'mapleblade'; // DB Name
$e_rate = '5x'; // Exp Rate
$m_rate = '1x'; // Meso Rate
$d_rate = '1x'; // Drop Rate
$version = '0.83'; // Version
$serverip = ""; // Replace with your WAN IP if public
$loginport = "8484"; // LoginPort [DEFAULT: 8484]
$forumlink = "http://forums.net"; // Forum link here.
$rewardnx = 1000; // Amount of NX for voting.
//Download links//
$client_link1 = ""; //Direct Download link here
$client_link2 = ""; //I prefer mediafire.
$setup_link1 = "http://download3.nexon.net/maplestory/fullversion/MSSetupv83.exe"; //from nexon itself. Atm it's v83
$setup_link2 = "http://tohbey.de/mssetupv83.exe"; //Just in case..
//Social Media
$facebooklink = "http://facebook.com";
$twitterlink = "http://www.Twitter.com";
$youtubelink = "http://www.YouTube.com";
// Opens connection to mysql server [DO NOT TOUCH THIS]
mysql_connect($host['hostname'],$host['user'],$host['password']) OR die("Can't connect to server");
mysql_select_db($host['database']) OR die("Cannot select DB");
if(basename($_SERVER["PHP_SELF"]) == "config.php"){
die("Error! Shit just happened");
}
function sql_injectionproof($sCode) {
if (function_exists("mysql_real_escape_string")) {
$sCode = mysql_real_escape_string($sCode);
} else {
$sCode = addslashes($sCode);
}
return $sCode;
}
?>
Oh, I suppose it might be important to say that I get no errors anywhere. Also, if you need another file, dont be afraid to ask. and my ip isnt normally blank, i just took that out for security reasons. (its usually my wan ip) Thanks for you help, PepsiNotCoke
Re: Server Status |CMS| problems
In config you never entered your ip...
Re: Server Status |CMS| problems
look at the bottom of my post.
Re: Server Status |CMS| problems
Replace This:
Code:
$fp = @fsockopen(SERVER_IP, LOGIN_PORT, $errno, $errstr, 1);
\
with:
Code:
$fp = @fsockopen($serverip, $loginport, $errno, $errstr, 1);
Re: Server Status |CMS| problems
Re: Server Status |CMS| problems
I remember having a CMS with the same problem a while ago, i could either make it only say online, or only say offline... guess which one it was ;D
Re: Server Status |CMS| problems
Quote:
Originally Posted by
iphone3GS
I remember having a CMS with the same problem a while ago, i could either make it only say online, or only say offline... guess which one it was ;D
Online :love:
Re: Server Status |CMS| problems
so umm.... anyone have a fix?
Re: Server Status |CMS| problems
Undo Every Mod you did to that Server Status and then Open your Config.
you have
Find:
$loginport = "8484";
you need to change it to
$serverip = "8484";
and add
$loginport = "7575";
so it looks like this
$serverip = "8484";
$loginport = "7575";
Oops Accidently Bumped a 1 Year old Thread >.>