I'm going to try making this easy to understand and hope it makes sense.
I have a PHP script / template and I want the end user to be able to know when I updated something, (eg. template change or a bugfix) and they can click a link to download the updated version from a remote host. I tried the scripts posted on PHP - How to check a script version and I sorta got this script working:
<?php define('REMOTE_VERSION', http://mysite.com/_client/client_name/update/version_check.txt');
define('VERSION', '2.0.1');
$script = file_get_contents(REMOTE_VERSION);
$version = VERSION;
if($version == $script) {
echo "<div class=success>
<p>You have the latest version!</p>
</div>";
} else {
echo "<div class=error>
<p>There is a update available!</p>
</div>";
}?>
Well sort of... The .txt file on my remote server just has 2.0.1. Since they are the same version (both 2.0.1), it should read "You have the latest version!" In this case it says "There is a update available!" no matter what number I put in.
define('VERSION', '2.0.1'); //in php above
2.0.5 //in .txt file on remote server
Says same things as it should because on the remote server is showing a new update (eg. 2.0.5). Can anyone tell me what I am doing wrong?
var_dump($script);to see if the output isstring(5) "2.0.1"(string with 5 characters). Your txt file can have BOM in the beginning of the file or just space / new line at the end.var_dump($script);after$script = file_get_contents(REMOTE_VERSION);and tell us what you get?