PDA

View Full Version : [How To] Version Check


King Kovifor
01 Jul 2006, 04:04
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
error_reporting(E_ALL & ~E_NOTICE);
define(DIR, dirname(__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!

Dan
01 Jul 2006, 04:36
and here i was going to write an extensive tutorial on how to set this up... maybe later ;)

King Kovifor
01 Jul 2006, 15:51
and here i was going to write an extensive tutorial on how to set this up... maybe later ;)
How more extensive can you get on this code?

Dan
01 Jul 2006, 20:03
No I was going to explain it a bit better.

King Kovifor
02 Jul 2006, 22:53
Ah...