Had altijd nog eens het idee om er eens iets mee te doen... Ik had laatst een helder moment en heb het hieronder eens neergezet.
De versie informatie wordt per website beveiligd met een identificatie code, en vervolgens gecodeerd verzonden door middel van de PHP md5 functie. Je zou toch zeggen dat het dan aardig veilig is.
Op de verschillende te controleren websites maak je een UDT met een unieke 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);
Iedere keer als iemand in de Admin uitlogt, dan zal het bestand opnieuw worden gegenereerd.
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;
}
}
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>www.website.org {read_version_file url="www.website.org" id="kjghlhgc55djf"}</p>
www website.com 1.8.2
website.nl 1.6.8
www website.org 1.8.2