コード例 #1
0
 /**
  * Checks if the spammer is in our database.
  *
  * @param string $nonce
  *
  * @return boolean
  */
 private function _checkDbNonces($nonce)
 {
     $return = false;
     $all = get_option($this->_core->getDbNonces());
     if (is_array($all)) {
         if (array_key_exists($nonce, $all)) {
             $return = true;
         }
     }
     return $return;
 }
 /**
  * Display the honeypot URL
  */
 public function getHtmlHoneyPotUrl()
 {
     $url = $this->_core->getOptionElement('php', 'honeypoturl');
     $words = array('intermittently', 'tawse', 'goldurn', 'coemption', 'semipurposive', 'tensibly', 'dissident', 'reductive', 'plowstaff', 'sprang', 'intersoluble', 'mildly', 'unrumpled', 'freeway', 'overappreciative', 'prealliance', 'hypercoagulability', 'makalu', 'aspersive', 'colleagueship', 'feminacy', 'cuirie', 'vanir', 'unvitalized', 'noncreativity', 'interproportional', 'areosystyle', 'exsolve', 'replow', 'septuor', 'comptrollership', 'mortarless', 'ruddily', 'find', 'poppy', 'knowledgeless', 'amenorrheal', 'referenced', 'veranda', 'parishad', 'lexeme', 'expediency', 'anemotropism', 'bangalay', 'complexional', 'uneminent', 'stephenville', 'lozenge', 'archiepiscopacy', 'propitiable');
     $keys = array_rand($words, 2);
     $text = $words[$keys[0]] . '-' . $words[$keys[1]];
     $url_array[] = '<div style="display: none;"><a href="%s">%s</a></div>';
     $url_array[] = '<a href="%s" style="display: none;">%s</a>';
     $url_array[] = '<a href="%s"><span style="display: none;">%s</span></a>';
     $url_array[] = '<a href="%s"><!-- %s --></a>';
     $url_array[] = '<!-- <a href="%s">%s</a> -->';
     $url_array[] = '<div style="position: absolute; top: -250px; left: -250px;"><a href="%s">%s</a></div>';
     $url_array[] = '<a href="%s"><span style="display: none;">%s</span></a>';
     $full_url = sprintf($url_array[array_rand($url_array)], $url, $text);
     return $full_url;
 }
コード例 #3
0
    /**
     * Called on activation of the plugin.
     */
    public function installPlugin()
    {
        global $wpdb;
        // Add Cron Job, the action is added in the Public class.
        if (!wp_next_scheduled('avhfdas_clean_nonce')) {
            wp_schedule_event(time(), 'daily', 'avhfdas_clean_nonce');
        }
        // Setup nonces db in options
        if (!get_option($this->_core->getDbNonces())) {
            update_option($this->_core->getDbNonces(), $this->_core->getDefaultNonces());
            wp_cache_flush();
            // Delete cache
        }
        // Setup the DB Tables
        $charset_collate = '';
        if (version_compare($wpdb->db_version(), '4.1.0', '>=')) {
            if (!empty($wpdb->charset)) {
                $charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
            }
            if (!empty($wpdb->collate)) {
                $charset_collate .= ' COLLATE ' . $wpdb->collate;
            }
        }
        if ($wpdb->get_var('show tables like \'' . $wpdb->avhfdasipcache . '\'') === null) {
            $sql = 'CREATE TABLE `' . $wpdb->avhfdasipcache . '` (
  					`ip` int(10) unsigned NOT null,
  					`added` datetime NOT null DEFAULT \'0000-00-00 00:00:00\',
  					`lastseen` datetime NOT null DEFAULT \'0000-00-00 00:00:00\',
  					`spam` tinyint(1) NOT null,
  					PRIMARY KEY (`ip`),
  					KEY `added` (`added`),
  					KEY `lastseen` (`lastseen`)
					) ' . $charset_collate . ';';
            $wpdb->query($sql);
        }
    }