// Take off the 3 turns for attacking
$player->take_turns(3);
$player->update();
// fire shots
if (DEBUG) {
    print "Pre Shots<br>";
}
portFires($fleet, $port, $players);
fleetFires($fleet, $port, $players, $weapons);
//get results in a way we want them
$results = processResults($players, $port, $fleet, $weapons);
//post on alliances MB or send to player
portDowngrade($results, $port);
sendReport($results, $port);
//log player
doLog($results);
//insert into combat logs
$finalResults = $results[0] . '<br /><img src="images/portAttack.jpg" width="480px" height="330px" alt="Port Attack" title="Port Attack"><br />' . $results[1];
$db->query('INSERT INTO combat_logs VALUES("",' . SmrSession::$game_id . ',"PORT",' . $player->sector_id . ',' . time() . ',' . SmrSession::$old_account_id . ',' . $player->alliance_id . ',0,0,"' . mysql_real_escape_string(gzcompress($finalResults)) . '", "FALSE")');
if (DEBUG) {
    print "Pre Forward/Display<br>";
}
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "port_attack_new.php";
$container["results"] = $results;
if ($players[$player->account_id][KILLER]) {
    $container['override_death'] = TRUE;
}
$container["continue"] = checkContinue($players, $port);
forward($container);
// fire shots
if (DEBUG) {
    $PHP_OUTPUT .= 'Pre Shots<br>';
}
portFires($fleet, $port, $players);
fleetFires($fleet, $port, $players, $weapons);
//get results in a way we want them
$results = processResults($players, $port, $fleet, $weapons);
//post on alliances MB or send to player
portDowngrade($results, $port);
sendReport($results, $port);
//log player
doLog($results);
//insert into combat logs
$finalResults = $results[0] . '<br /><img src="images/portAttack.jpg" width="480px" height="330px" alt="Port Attack" title="Port Attack"><br />' . $results[1];
$db->query('INSERT INTO combat_logs VALUES(\'\',' . SmrSession::$game_id . ',\'PORT\',' . $player->getSectorID() . ',' . TIME . ',' . SmrSession::$account_id . ',' . $player->getAllianceID() . ',0,0,' . $db->escapeBinary(gzcompress($finalResults)) . ', \'FALSE\')');
if (DEBUG) {
    $PHP_OUTPUT .= 'Pre Forward/Display<br>';
}
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'port_attack.php';
$container['results'] = $results;
if ($players[$player->getAccountID()][KILLER]) {
    $container['override_death'] = TRUE;
}
$container['continue'] = checkContinue($players, $port);
SmrPlayer::refreshCache();
SmrShip::refreshCache();
SmrPort::refreshCache();
forward($container);