Search for Plugins: Advanced
Please Sign in, Register or Resend Activation Email


  e107 :: Forums :: E107 Plugins :: Suggest a Plugin
<< Previous thread | Next thread >>  
Author Post
Thu Feb 22 2007, 03:54PM
Registered Member #64107
Joined: Sat Oct 07 2006, 10:22PM
Posts: 3
Has anyone made a plugin for Ultrastats to display the top ten players in a menu, Brutus did a php nuke one but im buggered if i can change it to work in E107.


//Coded by BRuTuS email: [email]
//SoF2 Top Ten Block for PHPNuke et al
//Special thanks to Sniperwolf-UA- for the help
//Ver 2.01

if (eregi("block-SoF2_Top_Ten_Players.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");}

// ----------------------------------------------------------
//** User Defined Variables:

$ultrastatsprefix = "stats_"; //** This is our ultrastats table prefix

$shareddatabase = 0; //** Set to 1 if Ultrastats shares the DB with Nuke, Otherwise set to 0

$linkedplayernames = 0; //** Set to 1 if you want players names hotlinked, 0 Disables

//** Set the next variable to the path to your players stats, ie
//If players stats are at [link]
//Prefix would be [link]

$siteprefix = "http:///";

$showkills = 1; //** Set to 1 to Display the kills count for each player listed. 0 Disables.

// ----------------------------------------------------------

$content = ""; //Start our Output
if ($shareddatabase != 1)
// Fill out the following information if your stats database is different then your Nuke Database
// ----------------------------------------------------------
$topten_dbhost = "localhost"; //* Database host
$topten_dbname = "statdb"; //* Database name
$topten_dbusername = "statdb"; //* Database user name
$topten_dbuserpw = "statdb"; //* Database password
// ----------------------------------------------------------

$db=mysql_connect($topten_dbhost, $topten_dbusername, $topten_dbuserpw) or $contentcheck = 404; //Connect
if ($contentcheck != 404)//Test if we connect
mysql_select_db($topten_dbname) or $contentcheck = 404; //Select our Database
global $dbhost, $dbuname, $dbpass, $dbname; //PHPNuke's DB Settings are stored here
global $dbi; //This is the database resource PHPNuke uses
$db=$dbi; //We'll leave Nuke's alone and clone it for our purposes

if ($contentcheck != 404) //Continue as long as no errors connecting to DB

$sql = "SELECT * FROM ".$ultrastatsprefix."players LIMIT 10"; //Test for data in our Tables
$topten_sql = mysql_query($sql,$db); //Execute
$numrows = mysql_num_rows($topten_sql); //Count rows
if ($numrows > 1) //We Have Data, Proceed
$sql = "SELECT ID,Kills FROM ".$ultrastatsprefix."players ORDER BY Kills DESC LIMIT 10"; //Select our Top 10 players by kills
$result = mysql_query($sql,$db); //Ask database via above statement
$rank = 0; //Keep Track of Ranks, Start at 0
while ($row = mysql_fetch_row($result)) //While we have data to work with, do:
$rank++; //Increase our rank count
$sql = "SELECT alias_html from ".$ultrastatsprefix."aliases WHERE player_id = '$row[0]' ORDER BY count DESC LIMIT 1"; //This will find player name
$playernamefetch = mysql_query($sql,$db); //Ask database via above statement
$playername = mysql_fetch_row($playernamefetch); //Pull the data returned by the DB
if ($rank < 10){ $content.="0";} //If our rank is less than 10, add a preceeding 0
$content .= $rank."-"; //prefix with our rank position
if ($linkedplayernames == 1) //Output if hotlinking is enabled
$content .="<a href=\"$siteprefix$row[0]\">$playername[0]</a>";
$content .="$playername[0]"; //Output Player List if hotlinking is disabled
if ($showkills == 1) //Output Kills if enabled
$content .="<br>with $row[1] Kills<br>\n"; //On the next line, moved over for readability
$content .="<br>\n"; //Just start a new line of Kills are disabled
$content .="<br><font class=\"tiny\">Made by:>BRuTuS</a></font>\n"; //Please leave this line here
else //No Data to Proceed
$content .= "No Information available!"; //Obilgatory Error Message
if ($shareddatabase != 1) //If we didn't use the Nuke Database
$db = mysql_connect($dbhost, $dbuname, $dbpass); //Reconnect to the Nuke Database (Using our resource, leave Nuke's Alone!)
mysql_select_db($dbname); //Reselect nuke's database
$content .="Error connecting to the database!<br>\n"; //You will only see this error if we could not connect to our database


Any help or a link if someone has achieved this would be most welcome

[ Edited Thu Feb 22 2007, 03:56PM ]
Wed Dec 10 2008, 12:46AM

Registered Member #92726
Joined: Wed Jan 23 2008, 10:15AM
Location: Earth
Posts: 31

Is this what you’re looking for?
UltraStats Flash Gizmo
Back to top
Fri Jan 02 2009, 12:56PM
Registered Member #78932
Joined: Fri Apr 20 2007, 12:55PM
Posts: 2
I made a custom menu for the top players along with one for the medals.

(Scroll down towards the bottom of the page)
Back to top
Sun Jan 04 2009, 02:36PM
Registered Member #101468
Joined: Wed Dec 10 2008, 07:00PM
Location: Wales / Pontypool
Posts: 5
Awsome how can we get hold of the plugin

Back to top
Thu Jan 22 2009, 07:00PM
Registered Member #102408
Joined: Thu Jan 22 2009, 06:56PM
Posts: 1
Any reply to that gijoe101st ?
You did a very nice work on that ... I would be most gratefull if you decide sharing it with us.

Thanks in advance.
Back to top
Sun Jan 25 2009, 05:06AM
Registered Member #99640
Joined: Fri Sep 19 2008, 05:04AM
Posts: 6
I would be very interested in this too gijoe...
Back to top

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System
Render time: 1.6987 sec, 0.2197 of that for queries. DB queries: 41.