Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define('REMOTE_VERSION', 'http://your.public.server/version.txt');
- // this is the version of the deployed script
- define('VERSION', '1.0.1');
- function isUpToDate()
- {
- $remoteVersion=trim(file_get_contents(REMOTE_VERSION));
- return version_compare(VERSION, $remoteVersion, 'ge');
- }
- 1.0.2
- // Substitue path to script with the version information in place of __FILE__ if necessary
- $script = file_get_contents(__FILE__);
- $version = SOME_SENSIBLE_DEFAULT_IN_CASE_OF_FAILURE;
- if(preg_match('/<!-- Script version (d*(.d+)*) -->/', $script, $version_match)) {
- $version = $version_match[1];
- }
- define('REMOTE_VERSION', 'http://your.public.server/version.txt');
- define('VERSION', '1.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>";
- }
Add Comment
Please, Sign In to add comment