문제

I’m trying to use BlackHole trap outlined here on my website, but I always get an error message saying “Error Opening file.”

 $fp = fopen($filename, 'r') or die('<p>Error opening file.</p>');
 while ($line = fgets($fp)) {
     if (!preg_match("/(googlebot|slurp|msnbot|teoma|yandex)/i", $line)) {
         $u = explode(' ', $line);
         if ($u[0] == $ipaddress) ++$badbot;
     }
 }

How can I fix it?

도움이 되었습니까?

해결책

Since your first line is as follows:

$fp = fopen($filename, 'r') or die('<p>Error opening file.</p>');

We can pretty quickly deduce that the fopen() call is failing. Verify that you're providing the function with a correct file path -- nothing after it matters if the file doesn't open!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top