function update_hotslogs_data()
{
    $last_scrape = get_option('hots_logs_last_scrape');
    if (current_time('timestamp') - $last_scrape >= 3600) {
        global $wpdb;
        $table_name = $wpdb->prefix . "hots_logs_plugin";
        $pids = $wpdb->get_col("SELECT player_id FROM {$table_name}");
        foreach ($pids as $pid) {
            insert_player(add_pid($pid));
        }
        $last_scrape = current_time('timestamp');
        update_option('hots_logs_last_scrape', $last_scrape);
    }
}
 // Call the html code
 function hots_logs_admin_menu()
 {
     // Add the options page
     add_options_page('Hots Logs', 'Hots Logs', 'administrator', 'hots_logs', 'hots_logs_html_page');
 }
 if (isset($_POST['player_id'])) {
     // PlayerID is a simple int max (9)
     $check_id = intval($_POST['player_id']);
     // Make sure player ID is a number
     if (strlen($check_id) > 9) {
         $check_id = substr($check_id, 0, 9);
     }
     include_once 'scraper/api_scraper.php';
     // Scraper will return false if an invalid hotslogs id is passed
     $valid_player = add_pid($check_id);
     // Scrape the page
     if ($valid_player != false) {
         insert_player($valid_player);
         // Insert the player
         add_action('admin_notices', 'player_added_notice');
         // Show success message
     } else {
         // If scraper returns false
         add_action('admin_notices', 'error_notice');
         // Show error notice take no other action
     }
 } elseif (isset($_POST['battle_tag'])) {
     $clean_tag = check_input($_POST['battle_tag'], $_POST['region']);
     // Check the user input
     if ($clean_tag != false) {