Okay, so I'm attempting to build a Signature Bar script for UnSyntax Software from the code Kerm posted in http://www.cemetech.net/forum/viewtopic.php?t=1040&start=300. However, I've run into a couple snags: I can't get the script to work properly and I don't know what exactly I'd need to put in .htaccess.
The code generates the image fine, but it doesn't generate user info from the ?uid=[#] in the URL. Am I missing something? Is this just not standard phpBB2 code?
Code:
As for .htaccess, I know I'd have to use a RewriteRule but I don't exactly understand how it works and Google isn't helping me much.
The code generates the image fine, but it doesn't generate user info from the ?uid=[#] in the URL. Am I missing something? Is this just not standard phpBB2 code?
Code:
<?
define('IN_PHPBB', true);
$site_root_path = '../';
$phpbb_root_path2 = '';
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');
$userdata = session_pagestart($user_ip, PAGE_VIEWONLINE);
init_userprefs($userdata);
$uid = preg_replace('/[^\d]/','',$_GET['uid']);
$sql = "SELECT * FROM forum_users WHERE user_id = '" . $uid . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$badge = imagecreatefrompng("unssbadge.png");
$red = imagecolorallocate($badge, 128, 0, 0);
$green = imagecolorallocate($badge, 0, 128, 0);
$black = imagecolorallocate($badge, 0, 0, 0);
if (isset($row['user_custom_title']) && $row['user_custom_title'] != NULL) { $title = $row['user_custom_title'];
} else if ($row['user_rank'] != 0 && $row['user_rank'] != NULL && isset($row['user_rank'])) {
$sql = "SELECT rank_title FROM forum_ranks WHERE rank_id = '" . $row['user_rank'] . "'";
$result = $db->sql_query($sql);
$row2 = $db->sql_fetchrow($result);
$title = $row2[0];
} else {
$sql = "SELECT * FROM forum_ranks WHERE rank_special <> '1'";
$result = $db->sql_query($sql);
while ($row2 = $db->sql_fetchrow($result))
{
if ($row2['rank_min'] < $row['user_posts']) { $title = $row2['rank_title']; }
}
}
$fitten = time() - 300;
$sql = "SELECT * FROM forum_sessions WHERE session_user_id = '" . $row['user_id'] . "' AND session_time > '$fitten'";
$result = $db->sql_query($sql);
////////////////////////////////////////
if ($db->sql_numrows($result) == 0)
{
imagestring ($badge, 2, 5, 26, 'OFFLINE', $red);
} else {
imagestring ($badge, 2, 5, 26, 'ONLINE', $green);
}
imagestring ($badge, 3, 5, 5, $row['username'], $black);
header("Content-type: image/png");
$width = 350;
$height = 38;
imagepng($badge);
imagedestroy($badge);
?>