<?
define('PROTECTOR', 1);

require_once'files/db.php';

$at = mysql_query('SHOW TABLES');  //получим список таблиц
while ($tables = mysql_fetch_assoc($at)) 
{ 
   foreach ($tables as $bd => $table) 
   { 
       mysql_query('OPTIMIZE TABLE `'.trim($table).'`')
           or die(mysql_error()); 
   }  
} 
?>