Quote:
Originally Posted by Korvacs
5165 DOES NOT use MySQL, it uses a flatfile ini database for everything, the MySQL username and password reference has nothing to do with the server, it was left in there from a time when they were thinking about using it.
Also, please search the release forum, there have been atleast 5 Register pages for the 5165 server.
|
My 5165 server does... His may also.
Start with the file that gives your server status...
make a new file called 'status.php' and place it where ever. Just make sure you update links.
PHP Code:
<div id="ServerStatus" style="width:200px; float:left"> <b>Server Status</b> <a href="#" onClick="SmartyAjax.update('ServerStatus', '/inc/status.php', 'get', 'f=getStatus'); return false;">(Refresh)</a><br />
<br />
<table width="150" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="200"><a href="http://www.yourserver.com/Server.zip">YourCo</a></td>
<td width="100"><span id="fffff"><?php
include ('config.php');
echo '';
$fp = @fsockopen($serveraddress, $serverport, $errno, $errstr, 1);
if (!$fp) {
echo '<font style="color: #FF3300"><b>Offline</b></font><br />';
}
else
{
echo '<font style="color: #00FF00"><b>Online</b></font><br />';
fclose($fp);
}
?></span></td>
</tr>
</table>
<table width="151" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="80"><a href="ventrilo://64.120.135.109:3784/servername=TrinityVentrilo">Ventrilo?</a></td>
<td width="51"><span id="fffff2"><?php
echo '';
$fp = @fsockopen($serveraddress2, $serverport2, $errno, $errstr, 1);
if (!$fp) {
echo '<font style="color: #FF3300"><b>Offline</b></font><br />';
}
else
{
echo '<font style="color: #00FF00"><b>Online</b></font><br />';
fclose($fp);
}
?></span></td>
</tr>
</table>
<table width="150" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="83"> <?php
include ('config.php');
$link=mysql_connect ($myhost, $myuser, $mypass) or die ('Error: ' . mysql_error());
mysql_select_db ($mydb);
$res = mysql_query("SELECT count(*) FROM accounts;");
$val = mysql_fetch_array($res);
echo "<div style='top: 460; left: 550; position: absolute; z-index: 1; visibility: show;'>Accounts Created: ".$val[0]."</div>";
?></td>
<br />
</tr>
</table>
<table width="150" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="140"><?php
include ('config.php');
$link=mysql_connect ($myhost, $myuser, $mypass) or die ('Error: ' . mysql_error());
mysql_select_db ($mydb);
$res = mysql_query("SELECT count(*) FROM entities;");
$val = mysql_fetch_array($res);
echo "<div style='top: 480; left: 550; position: absolute; z-index: 1; visibility: show;'>Characters Created: ".$val[0]."</div>";
?></td>
<br />
</tr>
</table>
<br />
<div id="ServerStatus2" style="width:200px; float:right">
<p><b>A place to put more stuff if needed..</b><br />
<br />
<br />
Stuff here...<a style="color:#F00;" href="http://www.yourserver.com/Server.zip" target="_blank">link here...</a><br />more stuff here...</p>
</div>
</div>
Then add a 'config.php', make sure its in the same folder as 'status.php'
PHP Code:
<?php
$myhost='sql ip';
$mypass='sql pass';
$myuser='sql user... usually 'root'';
$mydb='sql database';
$gamedb='character table..';
$accdb='accounts table...';
$serveraddress='server 1 ip here';
$serverport='server 1 port here';
$serveraddress2='server 2 ip...';
$serverport2='server 2 port here';
?>
Then add this somewhere between your [head] and [/head]
PHP Code:
<script src="source/js/prototype.js" type="text/javascript"></script>
<script src="source/js/smarty_ajax.js" type="text/javascript"></script>
Download 'prototype.js' and 'smarty_ajax.js' from the bottom of this post
And put them in a new folder located at webroot/source/js/
Find the line that says [body] and replace it with this
PHP Code:
<body onload="SmartyAjax.update('ServerStatus', 'inc/status.php', 'get', 'f=getStatus'); return false;"
<div id="ajax_loader">Loading Data</div>
Notice it says inc/status.php... If you have status.php in the root of your web folder make that 'status.php' instead of 'inc/status.php'
Then add this anywhere you like. You can add a float... You could map it with cords...... Place this anywhere you like.
PHP Code:
<div id="ServerStatus" style="width:200px; float:left"> <b>Server Status</b> <br />
</div>
That div will get refreshed by the 'smart_ajax' script adding the info from the status.php which reads from the config file to get your server ip and port to use to connect to your server and retrive server status and sql info.
You can add your php scripts that read how many players are logged in from your site and add it to this.
I'm not sure if this will fix your program but it's worth a shot!