Page 1 of 1

System update check from different server via file

Posted: Sat Oct 29, 2005 6:23 pm
by apoltix
I need a file update check for a php-system, where the system gets a file from another server (internet, not intranet), and compares the two file versions defined in the two files, where the first file already lies on the first server, and the second file is the one on the other server.

E.g. file one:

Code: Select all

<?php
$version = "1.0.0.1";
?>
And e.g. file two:

Code: Select all

<?php
$version = "1.0.1.4";
?>
The system then prints a text string (for example) where it says that there's a new version of the system. I've seen this in the phpBB2 code, though I can't "decode" the code in my head, and can't convert it into the correct version I need.

Note, that the system should also print a message, if the system is up-to-date (just add an } else {?)

Anybody that can help me with this one?

Posted: Sat Oct 29, 2005 7:23 pm
by roughian
<?php
include("file1.php");
$v1=$version;
include("file2.php");
$v2=$version;
echo $v1." ".$v2;
?>

Posted: Sat Oct 29, 2005 7:25 pm
by apoltix
Been there, done that. Doesn't work. It's also supposed to work, if the server is down, and the file can't be included. Then there shouldn't be an error like "could not include" or whatever.