Make-My-htpasswd/update.php

34 lines
796 B
PHP
Raw Normal View History

2018-02-21 19:28:02 +01:00
<?php
2018-02-21 20:05:46 +01:00
// tests to check UPDATE try to remplace file_get_contents with curl
// to avoid a allow_url_fopen Apache limitaion
2018-02-21 19:50:25 +01:00
$ch = curl_init("https://tools.echosystem.fr/Password/htpasswd/version.txt");
2018-02-21 19:28:02 +01:00
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// $retcode >= 400 -> not found, $retcode = 200, found.
echo $retcode;
curl_close($ch);
?>
2018-02-21 20:05:46 +01:00
2018-02-21 19:28:02 +01:00
<?php
2018-02-21 19:50:25 +01:00
define('REMOTE_VERSION', 'https://tools.echosystem.fr/Password/htpasswd/version.txt');
2018-02-21 19:28:02 +01:00
define('VERSION', '1.0.2');
$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>";
}
?>