Using md5_file(); doesn't return the md5 sometimes?
<?php
include_once('booter/login/includes/db.php');
$query="SELECT * FROM shells";
$result=mysql_query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
$hash = @md5_file($row['url']);
echo $hash . "<br>";
}
?>
The above is my code. Usually it works flawlessly on most urls, but every now and then it will just skip the md5 on a line, as if it doesn't retrieve it, even though the file is there.
I can't figure out why. Any ideas?
EDIT: When removing the '@' it returns this:
[function.md5-file]: failed to open stream: No s开发者_Python百科uch file or directory
The @
in front of md5_file
suppresses any warnings/errors that might be raised. Removing the @
will allow errors from md5_hash
to be displayed and will allow you to see why it is occasionally failing.
No such file or directory
simply means that there is no file with the name that has been searched. You might want to inspect the URLs that are causing those warnings; maybe they refer to a file that has been renamed or moved.
精彩评论