Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[Release] Dynamic Top Stats
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 380501" data-attributes="member: 36373"><p>Hey Devbest,</p><p></p><p>I am here to release a nice top stat page its going to be dynamic and simple <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /> Doesn't take up much space at all. Everything is manageable via the database.</p><p></p><p>First Add the table to the database:</p><p>[CODE]DROP TABLE IF EXISTS `cms_topstats`;</p><p>CREATE TABLE `cms_topstats` (</p><p> `stat` varchar(120) NOT NULL,</p><p> `limit` int(11) NOT NULL,</p><p> `table` varchar(80) NOT NULL,</p><p> `display` varchar(120) NOT NULL,</p><p> `order` varchar(5) NOT NULL DEFAULT '' COMMENT 'ASC or DESC',</p><p> `after` varchar(50) NOT NULL</p><p>) ENGINE=InnoDB DEFAULT CHARSET=utf8;[/CODE]</p><p></p><p>Next put the code in the stats page:</p><p></p><p>[CODE]<?php</p><p> function GetTimeDiff($time)</p><p> {</p><p> $d = floor($time/86400);</p><p> $_d = ($d < 10 ? '' : '').$d;</p><p> $h = floor(($time-$d*86400)/3600);</p><p> $_h = ($h < 10 ? '' : '').$h;</p><p> $time_str = $_d . ' days ' . $_h . ' hours';</p><p> return $time_str;</p><p> }</p><p> $getTopStats = mysql_query("SELECT * FROM `cms_TopStats`");</p><p> while($currentStat = mysql_fetch_assoc($getTopStats)){</p><p> ?></p><p> <div class="c-box" style="width:220px;display:inline-block;"></p><p> <div class="c-title red" style="width:220px;display:inline-block;"><?php echo $currentStat['display']; ?></div></p><p> <div class="c-main"></p><p> <?php</p><p> if($currentStat['table'] == "users"){</p><p> $getUserStats = mysql_query("SELECT * FROM ".$currentStat['table']." WHERE rank < 3 ORDER BY ".$currentStat['stat']." ".$currentStat['order']." LIMIT ".$currentStat['limit']."");</p><p> }else{</p><p> $getUserStats = mysql_query("SELECT * FROM ".$currentStat['table']." ORDER BY ".$currentStat['stat']." ".$currentStat['order']." LIMIT ".$currentStat['limit']."");</p><p> }</p><p> while($currentWinner = mysql_fetch_assoc($getUserStats)){</p><p> $userStats = mysql_fetch_assoc(mysql_query("SELECT `look`,`username` FROM users WHERE id = '".$currentWinner['id']."'"));</p><p> ?></p><p> <img style="float:left;display:inline-block;" src="http://www.habbo.com/habbo-imaging/avatarimage?figure=<?php echo $userStats['look']; ?>&direction=2&head_direction=3&size=s"></p><p> <br></p><p> <p style="overflow:none;"><span style="color:blue;"><?php echo $userStats['username'];?> ~ </span><span style="color:red;"><?php $value = $currentStat['stat'];if($currentStat['stat'] != "OnlineTime"){echo $currentWinner[$value];}else{echo GetTimeDiff($currentWinner[$value]);}echo $currentStat['after'];?></span></p></p><p> <br></p><p> <?php</p><p> }</p><p> ?></p><p> </div></p><p> </div></p><p> <?php</p><p> }</p><p> ?>[/CODE]</p><p></p><p>How it works:</p><p>Just add the stat into the database as follows;</p><p>Stat Name = The name of the column in the database (Credits/Activity_points/RoomVisits)</p><p>Limit = The number of records you would like to display (5/8/10)</p><p>Table = The name of the table the column is in (Users/user_stats)</p><p>Display = Text on the div box (Credits, Duckets, Online Time, Room Visits)</p><p>Order = ASC/DESC (Ascending or Descending)</p><p>After = Text after the output example: 500<strong>c</strong> 8 <strong>gifts</strong></p><p></p><p>Defaults I made for you:</p><p>[CODE]</p><p>INSERT INTO `cms_topstats` VALUES ('credits', '5', 'users', 'Credits', 'DESC', 'c');</p><p>INSERT INTO `cms_topstats` VALUES ('vip_points', '5', 'users', 'Diamonds', 'DESC', ' Diamonds');</p><p>INSERT INTO `cms_topstats` VALUES ('activity_points', '5', 'users', 'Duckets', 'DESC', ' Duckets');</p><p>INSERT INTO `cms_topstats` VALUES ('OnlineTime', '5', 'user_stats', 'Online Time', 'DESC', '');</p><p>INSERT INTO `cms_topstats` VALUES ('RoomVisits', '5', 'user_stats', 'Room Visits', 'DESC', ' Visits');</p><p>INSERT INTO `cms_topstats` VALUES ('Respect', '5', 'user_stats', 'Respects Recieved', 'DESC', ' Respects');</p><p>INSERT INTO `cms_topstats` VALUES ('RespectGiven', '5', 'user_stats', 'Respects Given', 'DESC', ' Respects');</p><p>INSERT INTO `cms_topstats` VALUES ('GiftsGiven', '5', 'user_stats', 'Gifts Given', 'DESC', ' Gifts');</p><p>[/CODE]</p><p></p><p>You can just add more if you would like, or change the ones already there. </p><p></p><p>TIP: Change the <div class="c-box"> and other div's to match your revcms edit, otherwise it will not display correctly.</p><p></p><p>Notice: This is a basic top stats, it just shows a small image of them with their username and then the stat. There is nothing special on the front end <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /> Feel free to edit that, and maybe re-release in the comments a nice front end and I will put it in the thread !</p><p></p><p>Thanks,</p><p>- JayCustom</p></blockquote><p></p>
[QUOTE="JayC, post: 380501, member: 36373"] Hey Devbest, I am here to release a nice top stat page its going to be dynamic and simple :) Doesn't take up much space at all. Everything is manageable via the database. First Add the table to the database: [CODE]DROP TABLE IF EXISTS `cms_topstats`; CREATE TABLE `cms_topstats` ( `stat` varchar(120) NOT NULL, `limit` int(11) NOT NULL, `table` varchar(80) NOT NULL, `display` varchar(120) NOT NULL, `order` varchar(5) NOT NULL DEFAULT '' COMMENT 'ASC or DESC', `after` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;[/CODE] Next put the code in the stats page: [CODE]<?php function GetTimeDiff($time) { $d = floor($time/86400); $_d = ($d < 10 ? '' : '').$d; $h = floor(($time-$d*86400)/3600); $_h = ($h < 10 ? '' : '').$h; $time_str = $_d . ' days ' . $_h . ' hours'; return $time_str; } $getTopStats = mysql_query("SELECT * FROM `cms_TopStats`"); while($currentStat = mysql_fetch_assoc($getTopStats)){ ?> <div class="c-box" style="width:220px;display:inline-block;"> <div class="c-title red" style="width:220px;display:inline-block;"><?php echo $currentStat['display']; ?></div> <div class="c-main"> <?php if($currentStat['table'] == "users"){ $getUserStats = mysql_query("SELECT * FROM ".$currentStat['table']." WHERE rank < 3 ORDER BY ".$currentStat['stat']." ".$currentStat['order']." LIMIT ".$currentStat['limit'].""); }else{ $getUserStats = mysql_query("SELECT * FROM ".$currentStat['table']." ORDER BY ".$currentStat['stat']." ".$currentStat['order']." LIMIT ".$currentStat['limit'].""); } while($currentWinner = mysql_fetch_assoc($getUserStats)){ $userStats = mysql_fetch_assoc(mysql_query("SELECT `look`,`username` FROM users WHERE id = '".$currentWinner['id']."'")); ?> <img style="float:left;display:inline-block;" src="http://www.habbo.com/habbo-imaging/avatarimage?figure=<?php echo $userStats['look']; ?>&direction=2&head_direction=3&size=s"> <br> <p style="overflow:none;"><span style="color:blue;"><?php echo $userStats['username'];?> ~ </span><span style="color:red;"><?php $value = $currentStat['stat'];if($currentStat['stat'] != "OnlineTime"){echo $currentWinner[$value];}else{echo GetTimeDiff($currentWinner[$value]);}echo $currentStat['after'];?></span></p> <br> <?php } ?> </div> </div> <?php } ?>[/CODE] How it works: Just add the stat into the database as follows; Stat Name = The name of the column in the database (Credits/Activity_points/RoomVisits) Limit = The number of records you would like to display (5/8/10) Table = The name of the table the column is in (Users/user_stats) Display = Text on the div box (Credits, Duckets, Online Time, Room Visits) Order = ASC/DESC (Ascending or Descending) After = Text after the output example: 500[B]c[/B] 8 [B]gifts[/B] Defaults I made for you: [CODE] INSERT INTO `cms_topstats` VALUES ('credits', '5', 'users', 'Credits', 'DESC', 'c'); INSERT INTO `cms_topstats` VALUES ('vip_points', '5', 'users', 'Diamonds', 'DESC', ' Diamonds'); INSERT INTO `cms_topstats` VALUES ('activity_points', '5', 'users', 'Duckets', 'DESC', ' Duckets'); INSERT INTO `cms_topstats` VALUES ('OnlineTime', '5', 'user_stats', 'Online Time', 'DESC', ''); INSERT INTO `cms_topstats` VALUES ('RoomVisits', '5', 'user_stats', 'Room Visits', 'DESC', ' Visits'); INSERT INTO `cms_topstats` VALUES ('Respect', '5', 'user_stats', 'Respects Recieved', 'DESC', ' Respects'); INSERT INTO `cms_topstats` VALUES ('RespectGiven', '5', 'user_stats', 'Respects Given', 'DESC', ' Respects'); INSERT INTO `cms_topstats` VALUES ('GiftsGiven', '5', 'user_stats', 'Gifts Given', 'DESC', ' Gifts'); [/CODE] You can just add more if you would like, or change the ones already there. TIP: Change the <div class="c-box"> and other div's to match your revcms edit, otherwise it will not display correctly. Notice: This is a basic top stats, it just shows a small image of them with their username and then the stat. There is nothing special on the front end :) Feel free to edit that, and maybe re-release in the comments a nice front end and I will put it in the thread ! Thanks, - JayCustom [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[Release] Dynamic Top Stats
Top