md5_file() not working with IP addresses?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-05-02T18:15:03Z Indexed on 2010/05/02 18:17 UTC
Read the original article Hit count: 175

Filed under:
|
|
|

Here is my code relating to the question:

$theurl = trim($_POST['url']);
    $md5file = md5_file($theurl);
        if ($md5file != '96a0cec80eb773687ca28840ecc67ca1') { echo 'Hash doesn\'t match. Incorrect file. Reupload it and try again'; 

When I run this script, it doesn't even output an error. It just stops. It loads for a bit, and then it just stops.

Further down the script I implement it again, and it fails here, too:

while($row=mysql_fetch_array($execquery, MYSQL_ASSOC)){

$hash = @md5_file($row['url']);

$url = $row['url'];

mysql_query("UPDATE urls SET hash='" . $hash . "' WHERE url='" . $url . "'") or die("MYSQL is indeed gay: ".mysql_error());

        if ($hash != '96a0cec80eb773687ca28840ecc67ca1'){
            $status = 'down';
            }else{
            $status = 'up';
            }
mysql_query("UPDATE urls SET status='" . $status . "' WHERE url='" . $url . "'") or die("MYSQL is indeed gay: ".mysql_error());

            }

And it checks all the URL's just fine, until it gets to one with an IP instead of a domain, such as:

http://188.72.215.195/config.php

In which, again, the script then just loads for a bit, and then stops.

Any help would be much appreciated, if you need any more information just ask.

© Stack Overflow or respective owner

Related posts about php

Related posts about md5