summaryrefslogtreecommitdiff
path: root/Badges_v2.php
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2008-06-18 21:01:20 +0200
committerHugues Hiegel <hugues@hiegel.fr>2008-06-18 21:01:20 +0200
commit2a5b7c103502a8440056acb63a546c72a5fb8d4d (patch)
tree53f6d601e9bc36ed3b864feb32994b0ed0af3665 /Badges_v2.php
parenteb07ceb7db40b14b5caacb142a2def5ef7c210ec (diff)
Tests if the md5sum of the temp file is the same as the stored stats file.
To be used in conjunction with the filemtime, to get sure we really have up to date statistics.
Diffstat (limited to 'Badges_v2.php')
-rw-r--r--Badges_v2.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/Badges_v2.php b/Badges_v2.php
index f3cd6a4..ec11360 100644
--- a/Badges_v2.php
+++ b/Badges_v2.php
@@ -41,7 +41,9 @@ if ( ! is_file($Stats)
||(filemtime($Stats) + CACHE < $_SERVER['REQUEST_TIME']))
{
system("wget -q --no-cache http://ws.audioscrobbler.com/1.0/user/".rawurlencode($username)."/profile.xml -O $Stats.tmp");
- if (!filesize("$Stats.tmp"))
+ if ( !filesize("$Stats.tmp")
+ ||(!strcmp(md5_file($Stats), md5_file("$Stats.tmp")))
+ )
system("rm $Stats.tmp");
else
system("mv $Stats.tmp $Stats");