[RESOLVED] Check Text File For Latest Version ?
Im looking for what I thought was a simple function, a script to define a number, lets say 100
I then want it to check a text file, if the text file has 100 in it , it displays "You have latest version" , If the textfile has 101 in it, it displays "Update available"
Hope you guys understand. Looking forward in seeing your ideas on this one. Cheers :thumb:
Re: Check Text File For Latest Version ?
this?
PHP Code:
<?php
$latestVersion = 100;
$installedVersion = file_get_contents("version.txt");
if($latestVersion <= (int) $installedVersion ){
echo "You have the latest version";
}else{
echo "There is an update available";
}
?>
Re: Check Text File For Latest Version ?
Ive tried that, but it only displays "You have the latest version" regardless of the contents of the textfile ?
Re: Check Text File For Latest Version ?
I understood your post as saying that the latest version is the number in the text file; if that's correct, then you just need to swap kows' variables:
PHP Code:
<?php
$installedVersion = 100;
$latestVersion = file_get_contents("version.txt");
if((int) $latestVersion <= $installedVersion){
echo "You have the latest version";
}else{
echo "There is an update available";
}
?>
Re: Check Text File For Latest Version ?
Fantastic, thats what im looking for. Thanks guys :D