prepare("INSERT INTO $table_name (pagenotfoundurl,pagenotfoundreferrers,pagenotfoundip, pagenotfounduseragent, pagenotfounddate) VALUES (%s, %s, %s, %s, %s)", $wpdb->escape($pagenotfoundurl),$wpdb->escape($pagenotfoundreferrers), $wpdb->escape($pagenotfoundip),$wpdb->escape($pagenotfounduseragent),$wpdb->escape($pagenotfounddate) ); $wpdb->query($m_mysql); } function tomas_check_bots() { $bots = array(); $bots[] = 'bot'; $bots[] = 'spider'; $bots[] = 'crawler'; $user_bots_or_not_agent = $_SERVER['HTTP_USER_AGENT']; $user_bots_or_not_result = false; foreach ( $bots as $bot_single ) { $bot_single = trim($bot_single); if ( !(empty($bot_single))) { $bot_single = strtolower($bot_single); $user_bots_or_not_agent = strtolower($user_bots_or_not_agent); if (strpos( $user_bots_or_not_agent, $bot_single ) === false) { $user_bots_or_not_result = false; } else { $user_bots_or_not_result = true; } } else { $user_bots_or_not_result = false; } } return $user_bots_or_not_result; } add_action( 'template_redirect', 'tomas_process_404s_log' ); function tomas_manage_404s() { global $wpdb,$table_prefix; $table_name = $table_prefix . "404s"; $m_checkHadThere = "SELECT * FROM $table_name"; $m_checkResult = $wpdb->get_results($m_checkHadThere,ARRAY_A); ?>