Jump to content


Photo

md5_file question


  • Please log in to reply
3 replies to this topic

#1 darkcarnival

darkcarnival
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 08 October 2006 - 04:13 PM

hi,

I'm interested in using the md5_file function as a way to check for a new verison of a script of mine.

currently i have a variable setup that i check but thats too much hassle when i have to update it for bug releases.

this md5_file function looks like something that would easier for me to check, if im wrong let me know.

now i checked on the php official site, but they dont give much detail on it so I'm hoping someone here knows a bit more about the workings of that function.

much thanks :)

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 08 October 2006 - 04:53 PM

example 1
http://www.w3schools...ng_md5_file.asp

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 08 October 2006 - 04:56 PM

Something like this should solve your problem.

<?php
$old = "the old hash would in some way be stored in this variable";

if(md5_file("http://example.com/the_file.tar.gz") === $old)
{
	echo "A new version has been released";
}
else {
	echo "No updates are available";
}
?>


#4 darkcarnival

darkcarnival
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 08 October 2006 - 11:05 PM

ok thank you guys for the pointers, I'll try it out later tonight.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users