Menu

blocking a poster

Help
2004-12-20
2012-10-11
  • Marjorie Roswell

    It's been a few years since I put up rawfoodwiki.org. So, a few years since I looked at the code. It's been running fine until recently, when a hacker keeps insisting on ruining my home page, no matter how many times I go back and replace it with the original content. I can see how to find the IP address, at least for the several time's he's posted. how do I block him? Will it work?

    • Margie
      mroswell@charm.net
     
    • Reini Urban

      Reini Urban - 2004-12-20

      somewhere early (lib/main.php)

      if ($_SERVER['REMOTE_ADDR'] == '128.0.0.someip') {
      $GLOBALS['request']->setStatus(403);
      exit;
      }

       
      • Marjorie Roswell

        Hi,
        I appreciate very much your reply! However, I must have a prior version of PHPWiki. That code doesn't exist in mine. Closest I have in the lib directory is Request.php, in code I copy below.

        ah, maybe your suggesting that I ADD that code.

        • Where would I add it?

        • How do I add multiple IP addresses?

        Sincerely,

        Margie

        function setStatus($status) {
            if (preg_match('|^HTTP/.*?\s(\d+)|i', $status, $m)) {
                header($status);
                $status = $m[1];
            }
            else {
                $status = (integer) $status;
                $reasons = array('200' => 'OK',
                                 '302' => 'Found',
                                 '400' => 'Bad Request',
                                 '401' => 'Unauthorized',
                                 '403' => 'Forbidden',
                                 '404' => 'Not Found');
                header(sprintf("HTTP/1.0 %d %s", $status, $reason[$status]));
            }
        
            if (isset($this->_log_entry))
                $this->_log_entry->setStatus($status);
        }
        
         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.