From c9f8c7abd211ebdb5a4c7d5797e3513aad14530d Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Fri, 8 Jul 2005 05:12:03 +0000 Subject: see changelog... --- play/index.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'play') diff --git a/play/index.php b/play/index.php index 9b3374c6..8555f444 100644 --- a/play/index.php +++ b/play/index.php @@ -251,13 +251,21 @@ else { } - while (!feof($fp) && (connection_status() == 0)) { - print(fread($fp, 8192)); - } - - if ( ! $start ) { - $user->update_stats($song_id); - } + /* Let's force them to actually play a portion of the song before + * we count it in the statistics + * @author SH + */ + $bytesStreamed = 0; + $minBytesStreamed = $song->size / 2; + while (!feof($fp) && (connection_status() == 0)) { + $buf = fread($fp, 8192); + print($buf); + $bytesStreamed += strlen($buf); + } + + if ($bytesStreamed > $minBytesStreamed) { + $user->update_stats($song_id); + } // If the played flag isn't set, set it if (!$song->played) { -- cgit