You are about to update the entries in the database to hashed version.
THIS IS CAH NOT BE UNDONE!
If any error occure during update and you run the update again some ip data might be wrong in db and not recoverable.

'; $page['body'] .= '

Click here to update database entries. WARNING: UPDATE IS IRREVERSABLE.

'; break; case 2: $page['body'] = '

All database IP entries have been hashed.

'; $sql_errors = ""; // Update bans table to hashed ip $query = prepare("SELECT DISTINCT `ipstart` FROM ``bans`` WHERE `ipstart` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter bans
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``bans`` SET `ipstart` = :ip, `ipend` = NULL WHERE `ipstart` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ipstart'])); $update_query->bindValue(':ip_org', $entry['ipstart']); $update_query->execute() or $sql_errors .= '
  • Alter bans
    ' . db_error() . '
  • '; } // Update custom_geoip table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``custom_geoip`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • custom_geoip
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``custom_geoip`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter custom_geoip
    ' . db_error() . '
  • '; } // Update flood table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``flood`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter flood
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``flood`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter flood
    ' . db_error() . '
  • '; } // Update ip_notes table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``ip_notes`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter ip_notes
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``ip_notes`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter ip_notes
    ' . db_error() . '
  • '; } // Update modlogs table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``modlogs`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter modlogs
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``modlogs`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter modlogs
    ' . db_error() . '
  • '; } // Update mutes table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``mutes`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter mutes
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``mutes`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter mutes
    ' . db_error() . '
  • '; } // Update posts_* table to hashed ip // Get list of boards $boards = listBoards(); foreach ($boards as &$_board) { $query = prepare(sprintf("SELECT DISTINCT `ip` FROM ``posts_%s`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'", $_board['uri'])); $query->execute() or $sql_errors .= '
  • posts_*
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare(sprintf("UPDATE ``posts_%s`` SET `ip` = :ip WHERE `ip` = :ip_org", $_board['uri'])); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter posts_*
    ' . db_error() . '
  • '; } } // Update reports table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``reports`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter reports
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``reports`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter reports
    ' . db_error() . '
  • '; } // Update nicenotices table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``nicenotices`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter nicenotices
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``nicenotices`` SET `ip` = :ip WHERE `ip` = :ip_org"); $query->bindValue(':ip', get_ip_hash($entry['ip'])); $query->bindValue(':ip_org', $entry['ip']); $query->execute() or $sql_errors .= '
  • Alter nicenotices
    ' . db_error() . '
  • '; } // Update search_queries table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``search_queries`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter search_queries
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``search_queries`` SET `ip` = :ip WHERE `ip` = :ip_org"); $query->bindValue(':ip', get_ip_hash($entry['ip'])); $query->bindValue(':ip_org', $entry['ip']); $query->execute() or $sql_errors .= '
  • Alter search_queries
    ' . db_error() . '
  • '; } // Update warnings table to hashed ip $query = prepare("SELECT DISTINCT `ip` FROM ``warnings`` WHERE `ip` REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$'"); $query->execute() or $sql_errors .= '
  • Alter warnings
    ' . db_error() . '
  • '; while($entry = $query->fetch()) { $update_query = prepare("UPDATE ``warnings`` SET `ip` = :ip WHERE `ip` = :ip_org"); $update_query->bindValue(':ip', get_ip_hash($entry['ip'])); $update_query->bindValue(':ip_org', $entry['ip']); $update_query->execute() or $sql_errors .= '
  • Alter warnings
    ' . db_error() . '
  • '; } if (!empty($sql_errors)) $page['body'] .= '

    SQL errors

    SQL errors were encountered when trying to update the database and hashing ip addresses.

    The errors encountered were:

    '; break; } echo Element('page.html', $page); ?>