TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 17, 2024, 10:43:26 AM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 59
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 63
  • Total: 63

Top Stats - 3 in 1 Block

Started by akulion, November 04, 2006, 03:53:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

#10
:D table row closed! :D

hey those are all ur codes yea?

ill make the correction :up:

***added***

here are some nice avatars for no avatar:





and one for guests



JPDeni

Quotehey those are all ur codes yea?
Sorta. I copied the top posters function from SSI.php and just added a WHERE clause. I don't need credit for these. :)

I really like the icon that looks like the picture has been cello-taped onto the page. That's very cute.

RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

bluedevil

This is pretty cool. Well done :up:

The only problem is,the center box got wider so it made the forum blocks out of place. Not much tho' but you still have to scroll over to see intire forum.

How i can i resize it?

akulion

do u have the Resizer-Function-2000 Mod installed?

akulion

lol im just kidding i made that one up

all u have to do is search for width=" in the code

u will see that where it says width="150" thats the LEFT column
where it says width="200" thats the CENTEr column

just change them around to fix it up :D
u'll find 2 instances of each

bluedevil

Quote from: Aku on November 04, 2006, 05:29:01 PM
lol im just kidding i made that one up

all u have to do is search for width=" in the code

u will see that where it says width="150" thats the LEFT column
where it says width="200" thats the CENTEr column

just change them around to fix it up :D
u'll find 2 instances of each

Thnx Aku!!!! :up:

akulion


metal13

cool... can you add avatars on ''Who's Online''??
Forum > Who's Online


http://www.tinyportal.net/smf/index.php?topic=9916.0

Sin69

Thanks Aku, I absolutely love this code and the Avatars too.

Thanks also to knat for turning it into a 4 in 1
and JPDeni for showing how to remove admin stats.

This post by nokonium gave me an alternative idea for the 4th column - a way to show Arcade High Scores using the Top Scores block.

Stitched it together in a phpbox, called it "Our Members" & Yay, it works!

Thanks Again Everyone!

Here's the...


global $db_prefix, $memberContext, $modSettings;

$count = 1;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND ID_GROUP <> 1 AND ID_GROUP <> 2 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" bordercolor="#444444" width="100%" id="table1" cellpadding="5" style="border-collapse: collapse">
<tr><td  bgcolor="#444444" width="10"><font color="#ffffff" face="Verdana" size="2"><b>Newest</b></font></td><td bgcolor="#444444" width="150"><font color="#ffffff" face="Verdana" size="2"><b>Top 6 Active</b></font></td><td  bgcolor="#444444"><font color="#ffffff" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#444444"><font color="#ffffff" face="Verdana" size="2"><b>High Scores</b></font></td></tr><tr>

<td  width="90">';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://yourwebsite.com/noava2.gif" height=80 widh=80><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 6; // You can change this to however many you want

$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
                          WHERE ID_GROUP <> 1
                          AND ID_GROUP <> 2
ORDER BY posts DESC
LIMIT $numberofposters", __FILE__, __LINE__);
$top_posters= array();
while ($row = mysql_fetch_assoc($request))
$top_posters[] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'posts' => $row['posts']
);
mysql_free_result($request);


echo'</td><td  width="150" align="left">';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);


while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 6;
  $name = str_replace(" ",'ÂÃ,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td width="150">';

//Arcade High Scores

// -- SETUP EDITS ---

$db_prefix = 'smf_'; //edit this to your your database prefix - usually smf_
$chno = 5; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players";
$txtwin = "Highest Scores :";
$txtlate = "Latest High Score by ";
$txtwit = "with ";
$txton = "on ";

global $scripturl;
require('./Settings.php');


$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);

// --START BLOCK CODE --
$content = "";  //set blank for a start

//Get newest champ or die
$sql = "SELECT m.ID_MEMBER,m.realName,g.id, g.game, g.name,g.champion_score "
. "FROM {$db_prefix}members m , {$db_prefix}games g "
. "WHERE g.champion_score > 0 AND m.ID_MEMBER=g.champion_member "
. "ORDER BY g.champion_time DESC LIMIT 0,1";

if(!($result = mysql_query($sql,$link)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['id'];
$game_name = $row['name'];
$score = $row['champion_score'];

//now get the pic for the game
$ext = array('gif','GIF','png','PNG','jpg','JPG',);
$game_pic = ""; // No thumbnail for default
foreach($ext as $ex)
{
if(file_exists($boarddir. "/Games/".$row['game'].".".$ex))
{
$game_pic = $boardurl."/Games/".$row['game'].".".$ex;
}
}


//Get the 10 best players or die
$sql = "SELECT m.ID_MEMBER, m.realName, count(g.id) As cnt"
. " FROM {$db_prefix}games g, {$db_prefix}members m"
. " WHERE m.ID_MEMBER=g.champion_member"
. " GROUP BY realName "
. " ORDER BY cnt DESC LIMIT 0,{$chno}";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the best players");
}

$row = mysql_fetch_assoc($result);

$score_poss=0; //players position

//make the block content
$content .= "<table width=\"100%\">";

$content .= "
<tr>
<td>
<marquee behavior='scroll' align='center' direction='up' height='100' scrollamount='1' scrolldelay='50' onmouseover='this.stop()' onmouseout='this.start()'>
<br />
<div align=\"center\"><a href=\"{$scripturl}?action=arcade;sa=play;game={$game_id}\"><img src=\"{$game_pic}\" border= \"0\" /></a>
<br />{$txtlate}<br />
<a href=\"{$scripturl}?action=profile;u=$playerid\">{$player}</a><br />{$txtwit} {$score} {$txton} {$game_name}
<br />------------------<br />{$txtplay}
<br /><br /> ";
do
{
$score_poss++;
$content .= "
$score_poss -
<a href=\"{$scripturl}?action=profile;u=".$row['ID_MEMBER']."\"> ".$row['realName']."</a>
<br /> $txtwin ".$row['cnt']."
<br /><br />";
}  while ($row = mysql_fetch_assoc($result));

mysql_free_result($result);
$content .= "</marquee></div></td></tr></table>" ;

echo $content;

echo '</td></tr></table>';