vonedaddy |
06-06-2006 04:20 AM |
PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # Toplist Hack - Version 1.0.6 # ||
|| # For vBulletin 3.5.3 # ||
|| # ---------------------------------------------------------------- # ||
|| # By Derek Ivey (derek@modbb.com) # ||
|| # This hack may not be redistributed without my written permission # ||
|| #################################################################### ||
\*======================================================================*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'toplist_dynamic_image');
// ######################### REQUIRE BACK-END ############################
// change the following to the path to your forum, with no ending slash.
chdir('/home/u1/vonaone/html/forum');
require_once('global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
// ############################## MISC STUFF #############################
header("Content-type: image/png");
$image = imagecreatefrompng("images/toplist/buttons/dynamic/background.png");
$color = imagecolorallocate($image, 0, 0, 255);
$font = 3;
// ######################### GRAB INFO FROM DB ###########################
//$sql = "SELECT * FROM " . TABLE_PREFIX . "toplist_sites WHERE id='8'";
$sql = "SELECT * FROM " . TABLE_PREFIX . "toplist_sites WHERE id='".$db->escape_string($_GET['id'])."'";
$sqlr = $db->query_read($sql);
$sr = $db->fetch_array($sqlr);
if ($vbulletin->options['toplist_ranking_method'] == 0)
{
$order = '`in`';
}
else if ($vbulletin->options['toplist_ranking_method'] == 1)
{
$order = 'out';
}
else if ($vbulletin->options['toplist_ranking_method'] == 2)
{
$order = 'rating_average';
}
else
{
$order = '`in`';
}
$rank1 = "SELECT * FROM " . TABLE_PREFIX . "toplist_sites ORDER BY ".$order." DESC";
$rank2 = $db->query_read($rank1);
$i = 1;
while($rank3 = $db->fetch_array($rank2))
{
if ($rank3['id'] == $_GET['id'])
{
$rank = $i;
}
else
{
$i++;
}
}
// ############################# CREATE IMAGE ############################
imagestring($image, $font, 44, 28, $rank, $color);
imagestring($image, $font, 52, 42, $sr['in'], $color);
imagestring($image, $font, 62, 56, $sr['out'], $color);
imagestring($image, $font, 52, 70, $sr['rating_average'], $color);
imagestring($image, 2, 5, 83, $sr['name'], $color);
imagepng($image);
imagedestroy($image);
?>
|