Back to vBulletin 3 Articles

[How To] Version Check
by King Kovifor 01 Jul 2006

This how to uses code I received from Dan - I've made modifcations...

Create a file and add it to your forum directory. Add the following content:

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);
define(DIRdirname(__FILE__));
include(
DIR '/includes/config.php');
define(TABLE_PREFIX$config['Database']['tableprefix']);

if (
$_REQUEST['product'])
{
    
mysql_connect($config['MasterServer']['servername'], $config['MasterServer']['username'], $config['MasterServer']['password'])
        or die(
'<strong>Error:</strong> Could not connect to the MySQL Server.');
    
mysql_select_db($config['Database']['dbname']) or die('<strong>Error:</strong> Could not select database.');
    
$result mysql_query("SELECT version FROM " TABLE_PREFIX "product WHERE productid = '" mysql_real_escape_string($_REQUEST['product']) . "' LIMIT 1");
    
$num_rows mysql_num_rows($result);
        
    if (
$num_rows == 1)
    {
        
$info mysql_fetch_array($result);
        
        print 
'<version productid="' $_REQUEST['product'] . '">' $info['version'] . '</version>';
    }
    else
    {
        die();
    }
}
else
{
    die();
}

?>
Save as anything thing. Upload to your forum directory.

When checking versions. The link should be:

http://yours.tld/forum_dir/file_name.php?product=PRODUCT_ID

That'll check the forum the file is installed on. Make sure that you have the latest version installed on the forum where you uploaded the file.

Thanks to DAN for the code!

vblts.ru supports vBulletin®, 2022-2024