tags:

views:

69

answers:

1
<?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 such file or directory

+1  A: 

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.

Mark Rushakoff
Not sure why I didn't think of that. Topic edited
Rob
I checked the url. its there
Rob
If you want to debug it, print the row values if you hit any errors (so you can see them as PHP does). If you just want to avoid errors, check if the file can be found (and/or opened) before generating the MD5.
peachykeen