I have created two small User Defined Tags (UDTs). One for the clientside and one for the serverside. The data is stored in a automaticly created textfile on the clients server, you can change the name of this file and the folder where it is stored.
You can secure the version information per website with an identification code, and the info will be hashed transmitted by means of the PHP md5 function.
I would say it is fairly safe...
Client side
At the client websites you create the following UDT with a unique id code:
set_version_file
Code: Select all
// CLIENT CODE
// The unique id code must be equal to the one used in the {read_version_file} tag in the receiving site
$id = "hfue3nfls91";
// The filename should be the same as in the {read_version_file} tag
$file = "tmp/version.txt";
$create_write = @fopen(($_SERVER['DOCUMENT_ROOT'] . "/" . $file), 'w') or die("ERROR set_version_file UDT: Can't create or open version file!!");
global $CMS_VERSION;
$current_version= $CMS_VERSION;
$send_code = md5(($id . $current_version));
fwrite($create_write, $send_code);
fclose($create_write);
Every time somebody logs out of the admin, the data file is updated
Server side
Create another UDT at your own (secured) website:
read_version_file
Code: Select all
// SERVER CODE
// Example: {read_version_file url="www.yourwebsitename.com" id="hfue3nfls91"}
// The id code must be the same as in the 'set_version_file' udt in the other website
$id = $params[id];
$url = $params[url];
// The filename must be the same as in the 'set_version_file' udt
$file = "tmp/version.txt";
$complete_url = ("http://" . $url . "/" . $file);
$received_code = @file_get_contents($complete_url);
// Enter new release numbers below!
$cms_release = array (
"1.6",
"1.6.1",
"1.6.2",
"1.6.3",
"1.6.4",
"1.6.5",
"1.6.6",
"1.6.7",
"1.6.8",
"1.7",
"1.7.1",
"1.7.2",
"1.8",
"1.8.1",
"1.8.2",
"1.8.3",
"1.9",
"2.0",
"2.1",
"2.2",
"2.3"
);
foreach ($cms_release as $foo) {
$bar = md5(($id . $foo));
if ($bar == $received_code) {
echo $foo;
}
}
In a secured webpage you can use the {read_version_file} tag like this:
Code: Select all
<p>www website.com {read_version_file url="www.website.com" id="hfue3nfls91"}</p>
<p>website.nl {read_version_file url="website.nl" id="hg6ogjvdruik33"}</p>
<p>www2 website.org {read_version_file url="www2.website.org" id="kjghlhgc55djf"}</p>
You will create a list of client websites, with it CMS version behind it:
www website.com 1.8.2
website.nl 1.6.8
www2 website.org 1.8.2