示例#1
0
require_once 'app_code/DataManager.php';
$brow = EveBowserFactory::Get();
if (!($brow->IsIGB() && $brow->IsTrusted())) {
    RedirectResponse('links.php');
}
if (isset($_POST['fleetLink']) && isset($_POST['name'])) {
    $matches;
    if (preg_match('/gang:(?<id>\\d+)/', GetPost('fleetLink'), $matches)) {
        $a = Alliance::EnsureAlliance($brow->AllianceId(), $brow->AllianceName());
        $f = new Fleet();
        $f->Id = $matches['id'];
        $f->AllianceId = $a->Id;
        $f->Name = GetPost('name');
        $f->Added = time();
        if ($f->Validate()) {
            $f->Save();
            // this seems like a good place to delete old fleets
            Fleet::DeleteOldFleets();
            DataManager::GetInstance()->CloseConnection();
            RedirectResponse('links.php');
        }
    }
}
?>

<html>

<head>
	<title>Fleet Links - Add Fleet</title>
</head>