HOLOCMS Top Users [PLUGIN]
Hello Everyone, I'm not sure if this has been made yet but I have made on for the HabboCMS but not for Holo. I believe I was asked to make one for Holo but I just finally found time by doing so ;)
For Example I will allow anyone to play with the script.. You can use this for anything.. Really its just a pagination script.
I will take the credits.php page and transform it into showing everyone how much credits each users have.
What you will find in your credits.php...
Code:
<div id='container'>
<div id='content'>
<div id='column1' class='column'><div class='habblet-container '>
<div class='cbb clearfix green '>
<h2 class='title'><?php echo stripslashes(getContent('credits2-heading')); ?></h2>
<p class='credits-countries-select'><?php echo stripslashes(getContent('credits2')); ?></p>
</div>
</div>
Add underneath it..
Code:
<div id='container'>
<div id='content'>
<div id='column1' class='column'><div class='habblet-container '>
<div class='cbb clearfix green '>
<h2 class='title'>Top Credits</h2>
<p class='credits-countries-select'><?php
// database connection info
$conn = mysql_connect('localhost','DBUSERNAME','DBPASSWORD') or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('holodb',$conn) or trigger_error("SQL", E_USER_ERROR);
// find out how many rows are in the table
$sql = "SELECT COUNT(*) FROM users";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 30;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$sql = "SELECT name, credits FROM users ORDER BY rank DESC,name LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result)) {
// echo data
echo $list[''] . "<a href=\"user_profile.php?name=" . $list['name'] . "\">" . $list['name'] . " - (<font size='1'><EM></b>" . $list['credits'] . ")</EM></font><br />";
} // end while
/****** build the pagination links ******/
// range of num links to show
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
// echo forward link for lastpage
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
} // end if
/****** end build pagination links ******/
?>
Change the DBUSERNAME and DBPASSWORD for your mysql/phpmyadmin.
The default database->Table is holodb but you can change that if you have a different name. You can also play with the script to have other things like wobble squabble scores and show all the rooms that are created in your hotel and really pretty much anything in your database.
Screenshot of the final result.
http://i100.photobucket.com/albums/m...topcredits.png
http://i100.photobucket.com/albums/m...topcredits.png
Enjoy!
Steven
P.S. I've made it so that when you click on the user, it redirects to their profile page.
Re: HOLOCMS Top Users [PLUGIN]
Nice if you want to make others jealous! :):
Re: HOLOCMS Top Users [PLUGIN]
Hehe, Thoughtso too :)
I forgot to mention that you can change the filter so that its in order, From biggest amount of credits to least it would be..
Find;
Code:
$sql = "SELECT name, credits FROM users ORDER BY rank DESC,name LIMIT $offset, $rowsperpage";
Replace;
Code:
$sql = "SELECT name, credits FROM users ORDER BY credits DESC,name LIMIT $offset, $rowsperpage";
Re: HOLOCMS Top Users [PLUGIN]
You should fix the page design, it's out of place and looks crap!
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
StevenisSolar
Hehe, Thoughtso too :)
I forgot to mention that you can change the filter so that its in order, From biggest amount of credits to least it would be..
Find;
Code:
$sql = "SELECT name, credits FROM users ORDER BY rank DESC,name LIMIT $offset, $rowsperpage";
Replace;
Code:
$sql = "SELECT name, credits FROM users ORDER BY credits DESC,name LIMIT $offset, $rowsperpage";
Depends on the fact if you want to order them by their rank or credits amount.
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
StevenisSolar
Hello Everyone, I'm not sure if this has been made yet but I have made on for the HabboCMS but not for Holo. I believe I was asked to make one for Holo but I just finally found time by doing so ;)
For Example I will allow anyone to play with the script.. You can use this for anything.. Really its just a pagination script.
I will take the credits.php page and transform it into showing everyone how much credits each users have.
What you will find in your credits.php...
Code:
<div id='container'>
<div id='content'>
<div id='column1' class='column'><div class='habblet-container '>
<div class='cbb clearfix green '>
<h2 class='title'><?php echo stripslashes(getContent('credits2-heading')); ?></h2>
<p class='credits-countries-select'><?php echo stripslashes(getContent('credits2')); ?></p>
</div>
</div>
Add underneath it..
Code:
<div id='container'>
<div id='content'>
<div id='column1' class='column'><div class='habblet-container '>
<div class='cbb clearfix green '>
<h2 class='title'>Top Credits</h2>
<p class='credits-countries-select'><?php
// database connection info
$conn = mysql_connect('localhost','DBUSERNAME','DBPASSWORD') or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('holodb',$conn) or trigger_error("SQL", E_USER_ERROR);
// find out how many rows are in the table
$sql = "SELECT COUNT(*) FROM users";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 30;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$sql = "SELECT name, credits FROM users ORDER BY rank DESC,name LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result)) {
// echo data
echo $list[''] . "<a href=\"user_profile.php?name=" . $list['name'] . "\">" . $list['name'] . " - (<font size='1'><EM></b>" . $list['credits'] . ")</EM></font><br />";
} // end while
/****** build the pagination links ******/
// range of num links to show
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
// echo forward link for lastpage
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
} // end if
/****** end build pagination links ******/
?>
Change the DBUSERNAME and DBPASSWORD for your mysql/phpmyadmin.
The default database->Table is holodb but you can change that if you have a different name. You can also play with the script to have other things like wobble squabble scores and show all the rooms that are created in your hotel and really pretty much anything in your database.
Screenshot of the final result.
http://i100.photobucket.com/albums/m...topcredits.png
http://i100.photobucket.com/albums/m...topcredits.png
Enjoy!
Steven
P.S. I've made it so that when you click on the user, it redirects to their profile page.
You shouldent have to change SQL details. Include the core.php and session.php
Re: HOLOCMS Top Users [PLUGIN]
Heh, Kaboom, Your right about the layout. oops! :)
But is the sql the same as the pagination script I just posted? and probably can be edit so it is. I made it in like 10 minutes and really never looked at anything else, Just installed the holocms quickly and just deleted now :D
You can edit the code and post it Kaboom if you like, I just noticed your "Clean Hand Script" :)
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
StevenisSolar
Heh, Kaboom, Your right about the layout. oops! :)
But is the sql the same as the pagination script I just posted? and probably can be edit so it is. I made it in like 10 minutes and really never looked at anything else, Just installed the holocms quickly and just deleted now :D
You can edit the code and post it Kaboom if you like, I just noticed your "Clean Hand Script" :)
I'll clean it up for you. The page shouldent be like that (I was not being rude!). Give me a couple of miniutes and ill put up a clean version ;) :D:
Re: HOLOCMS Top Users [PLUGIN]
http://i85.photobucket.com/albums/k7...002g/new-1.png
I have updated the page look only! I don't have the time to look thought the SQL to change it all :ott1:
[PHP]<?php
/*===================================================+
|| # HoloCMS - Website and Content Management System
|+===================================================+
|| # Copyright
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
Neroez
Nice if you want to make others jealous! :):
Agreed, also its kinda... pointless especially if you always see 'staff members' on the list, so include them ONLY by their rank? ;P Just an idea.
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
Moogly
Agreed, also its kinda... pointless especially if you always see 'staff members' on the list, so include them ONLY by their rank? ;P Just an idea.
It can easily be sorted, just add the ranks on which should be shown, such as rank 1 and 2. ;) I might use this but not for credits ;)
Re: HOLOCMS Top Users [PLUGIN]
hmmm not so good release, i have better seen on my own hotel.
But a good begin!
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
sjongejan
hmmm not so good release, i have better seen on my own hotel.
But a good begin!
It's an ok bit of code.
Re: HOLOCMS Top Users [PLUGIN]
Yess ofcourse.....
But i've better codes see, sorry:$
Re: HOLOCMS Top Users [PLUGIN]
Quote:
Originally Posted by
sjongejan
Yess ofcourse.....
But i've better codes see, sorry:$
Good for you?
Don't spam his topic with shit then, if it's that good send me a copy and ill tell you if it is or not ;)
(and no i don't want your source or anything along those lines. I am advanced with SQL and PHP)