- Joined
- Jul 8, 2007
- Messages
- 1,627
- Reaction score
- 1,613
Since i struggled to find the php scripts for SQL 2005 that were working....
ill release them here...Credits to those who made them and thanks for sharing them
(YOU WILL NEED TO EDIT THE PASSWORDS IN THESE SCRIPTS TO GET THEM TO CONNECTO TO YOUR SERVER!)
CastleOwner.php (Who owns the Castle)
MoneyRanking.php (Which players have the most money)
Online.php (shows how many players are online - updates once every 30 minutes)
ServerStatus.php (Shows if the server is online or offline ... you will need to make 2 image files - online.png and offline.png and put them in the same folder as this script)
THE RANKINGS
REGISTER
AND TOP 3 PLAYERS can be downloaded from the attacthed files
ill release them here...Credits to those who made them and thanks for sharing them
(YOU WILL NEED TO EDIT THE PASSWORDS IN THESE SCRIPTS TO GET THEM TO CONNECTO TO YOUR SERVER!)
CastleOwner.php (Who owns the Castle)
Code:
<?php
$config = array(
'db_username' => 'sa', // database username
'db_password' => 'YOURPASSHERE', // database password
'db_dsn' => 'kal_db', // system DSN to the database
'debug' => false,
);
$conn = odbc_connect($config['db_dsn'],
$config['db_username'],
$config['db_password']);
$guild_query = odbc_exec($conn,"SELECT [GID] FROM GuildCastle WHERE CID = 1");
$guild2 = odbc_fetch_array($guild_query);
$guildGID = $guild2[0];
$guild_query = odbc_exec($conn,"SELECT [Name] FROM Guild WHERE GID = '".$guildGID."'");
$guild2 = odbc_fetch_array($guild_query);
$guild = $guild2[0];
if($guild)
echo "<p>Castle Owner: $guild</p>";
else
echo "<p>Castle Owner: None</p>";
?>
MoneyRanking.php (Which players have the most money)
Code:
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Shortcut Icon" href="favicon.ico">
<?php
// table style
DEFINE("STYLE", "font: 12px Verdana, Geneva, sans-serif; color: black; text-align; center;");
$config = array(
'db_username' => 'sa', // database username
'db_password' => 'YOURPASSWORDHERE', // database password
'db_dsn' => 'kal_db', // system DSN to the database
'debug' => false,
);
$conn = odbc_connect($config['db_dsn'],
$config['db_username'],
$config['db_password']);
$top = 1;
$plist = "SELECT TOP 100 Player.Name, Player.Level, Player.Specialty, Item.Num, Player.Class
FROM Player
LEFT JOIN Item
ON Player.PID=Item.PID
WHERE
[Index] = 31
ORDER BY
Item.Num DESC";
$pplist = odbc_exec($conn,$plist);
echo '<br><br><br>';
echo '<center><table width="400px" style="STYLE">';
echo '<tr style="text-align: center">
<td width="100px"><b>Rank</b></td>
<td width="100px"><b>Name</b></td>
<td width="100px"><b>Gold</b></td></tr>';
while($r = odbc_fetch_array($pplist)){
echo '<tr style="text-align: center"><td>'.$top.'</td><td>'.$r['Name'].'</td><td>'.$r['Num'].'</td></tr>';
$top++;
}
echo '</table>';
Online.php (shows how many players are online - updates once every 30 minutes)
Code:
<?php
$config = array(
'db_username' => 'sa', // database username
'db_password' => 'YOURPASSWORDHERE', // database password
'db_dsn' => 'kal_db', // system DSN to the database
'debug' => false,
);
$conn = odbc_connect($config['db_dsn'],
$config['db_username'],
$config['db_password']);
$st = "SELECT TotalUser FROM [Statistics]";
$st2 = odbc_exec($conn,$st);
while($r = odbc_fetch_array($st2)){
$on = $r['TotalUser'];
};
if(empty($on))
{
echo '<font color="red">Players Online <b>0</b></font><br>';
}
if(!empty($on)){
echo "Players Online : <b>$on</b><br>";
}
?>
ServerStatus.php (Shows if the server is online or offline ... you will need to make 2 image files - online.png and offline.png and put them in the same folder as this script)
Code:
<html>
<style type="text/css">
body {
margin: 0px;
}
</style>
<header></header>
<body>
<script>
<!--
/*
Auto Refresh Page with Time script
By JavaScript Kit (javascriptkit.com)
Over 200+ free scripts here!
*/
//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:5"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
window.onload=beginrefresh
//-->
</script>
<?php
$fp = @fsockopen ("127.0.0.1", 30001, $errno, $errstr, 10); // 10 = sec. timeout
if (!$fp) {
echo "<img src=\"offline.png\" width=\"158\" height=\"128\" alt=\"ServerOffline\" longdesc=\"offliine.png\" />";
}
else
{
echo "<img src=\"online.png\" width=\"158\" height=\"128\" alt=\"ServerOnline\" longdesc=\"online.png\" />";
}
@fclose($fp);
?>
</body>
</html>
THE RANKINGS
REGISTER
AND TOP 3 PLAYERS can be downloaded from the attacthed files

