PHP and vbulletin help
Posted: Sat Oct 24, 2009 10:15 am
Hi, Im new here.
I was wondering if anyone could help me with some php scripts im working on for vbulletin.
I have made dynamic sig scripts for MyBB (using GD Library) But i cantseem to get it to work for vBulletin. The problem is i have no test server for vbulletin and am using a friends site to test my scripts. I cant seem to get the SQL queries right. I have tried looking on the net for vbulletin class funcitons but none work.
This was my first attempt using just SQL:
Then this was my attempt using the vBulletin class functions (which just gave a vbulletin database error:
I was wondering if anyone could help me with some php scripts im working on for vbulletin.
I have made dynamic sig scripts for MyBB (using GD Library) But i cantseem to get it to work for vBulletin. The problem is i have no test server for vbulletin and am using a friends site to test my scripts. I cant seem to get the SQL queries right. I have tried looking on the net for vbulletin class funcitons but none work.
This was my first attempt using just SQL:
Code: Select all
<?php
/**
* vBulletin Userbar Script v1.0
*
* GFX-Core.com
* Gfx and PHP script site.
* Created by Tommy
*/
$forumname= "yoursite.com";
define('CWD', (($getcwd = getcwd()) ? $getcwd : '.'));
define('THIS_SCRIPT', 'sig');
require_once(CWD . '/includes/init.php');
//replace these with the correct info for your database connection.
$db = mysql_connect("localhost","user","password");
if (!$db)
{
die('Could not connect: ' . mysql_error());
}
//replace DATABASENAME with the forum database name
mysql_select_db("DATABASENAME", $db);
$uid = $_GET['uid']
$query = "SELECT username, posts, usergroupid FROM users WHERE uid='$uid'";
$result = mysql_query($query, $db);
$user = mysql_fetch_array($result)
header("Content-type: image/png");
$im = imageCreateFromPNG("./images/statsig1.png");
$text_color = ImageColorAllocate ($im, 255, 255, 255);
imagestring($im, 2, 5, 2, ($user['username']). " is a member of" . $forumname, $text_color);
imagestring($im, 2, 5, 15, "Usergroup: " . ($user['usergroupid']), $text_color);
imagestring($im, 2, 140, 15, "Posts: " . ($user['posts']), $text_color);
imagepng($im);
imagedestroy($im);
?>Code: Select all
<?php
/**
* vBulletin Userbar Script v1.0
*
* GFX-Core.com
* Gfx and PHP script site.
* Created by Tommy
*/
$forumname= "yoursite.com";
define('CWD', (($getcwd = getcwd()) ? $getcwd : '.'));
define('THIS_SCRIPT', 'sig');
require_once(CWD . '/includes/init.php');
require_once(CWD . '/includes/config.php');
$uid = $_GET['uid'];
$result = $db->query_read("SELECT username, posts, usergroupid FROM " . TABLE_PREFIX . "user WHERE userid = $uid");
$user = $db->fetch_array($result);
header("Content-type: image/png");
$im = imageCreateFromPNG("./images/statsig1.png");
$text_color = ImageColorAllocate ($im, 255, 255, 255);
imagestring($im, 2, 5, 2, ($user['username']). " is a member of" . $forumname, $text_color);
imagestring($im, 2, 5, 15, "Usergroup: " . ($user['usergroupid']), $text_color);
imagestring($im, 2, 140, 15, "Posts: " . ($user['posts']), $text_color);
imagepng($im);
imagedestroy($im);
?>