TinyPortal

Development => Resources => Topic started by: DarkWolf on July 22, 2010, 12:47:21 AM

Title: Code: CRC32, MD5, SHA-1 check in download area :)
Post by: DarkWolf on July 22, 2010, 12:47:21 AM
File: /Themes/default/TPdlmanager.template.php

Simply search:

'<div>' . $dlitem['description'] , '</div>

Change to:

echo
'<div>' . $dlitem['description'] , '</div>
<hr />
<div>CRC32: '.str_pad(strtoupper(dechex(crc32(file_get_contents($boarddir.'/tp-downloads/'.$dlitem['file'])))), 8, '0', STR_PAD_LEFT).'</div>
<div>MD5: '.strtoupper(md5_file($boarddir.'/tp-downloads/'.$dlitem['file'])).'</div>
<div>SHA-1: '.strtoupper(sha1_file($boarddir.'/tp-downloads/'.$dlitem['file'])).'</div>


You can see a demo here: http://darkwolf.altervista.org/tpmod/?dl=0 :)
Title: Re: Code: CRC32, MD5, SHA-1 check in download area :)
Post by: Freddy on July 22, 2010, 01:29:27 PM
Nice, thanks DarkWolf  O0
Title: Re: Code: CRC32, MD5, SHA-1 check in download area :)
Post by: DarkWolf on July 22, 2010, 04:46:15 PM
Important fix :P
With precedent code every refresh cause an increment of 3 download in download number (it use getid).
I've fixed with this (i don't have used full url to bypass htaccess in tp_downloads) > see new code above ;)
-
I've changed: $dlitem['href'] to $boarddir.'/tp-downloads/'.$dlitem['file']