Exemplo n.º 1
0
 /**
  * Block a page if referer is found on list of blocked domains
  *
  * @param string|bool $action If false, send 403 response; if URL, redirect here; if string, print message
  */
 public static function block($action = false)
 {
     // Try to update the list
     if (!defined('SEMALT_UNIT_TESTING')) {
         SemaltUpdater::update();
     }
     // Simply stop here if referer is not on the list
     if (!self::isRefererOnBlocklist()) {
         return;
     }
     self::doBlock($action);
     // Stop execution altogether, bye bye bots
     if (!defined('SEMALT_UNIT_TESTING')) {
         exit;
     }
 }
Exemplo n.º 2
0
 public static function block($action = false)
 {
     SemaltUpdater::update();
     if (!self::isRefererOnBlocklist()) {
         return;
     }
     self::cls();
     self::blockAction($action);
     echo "This website has been blocked because your referral is set to " . self::getHttpReferer() . ". " . "<a href='https://www.google.com/#q=" . htmlspecialchars(preg_replace('/http:\\/\\//', '', self::getHttpReferer())) . " spam'>Read why</a>";
     exit;
 }