<?php

include 'db_connection.php';
include 'classes/team.php';
$connection = new db_connection();
$employee = $_POST['employee'];
$team = $_POST['team'];
/*Transaction status*/
$status = 'ok';
if (!team::addEmployee($connection, $employee, $team)) {
    //Error
    $error = $connection->lastError();
    if ($error['errno'] == 1062) {
        //UQ value error
        $status = "repeat";
    } else {
        $status = "Error {$error['errno']}: {$error['error']}";
    }
}
/*XML transaction result.*/
header('Content-Type: text/xml');
echo '<transaction>
<status>' . $status . '</status>
</transaction>
';
$connection->close();