<?php

session_start(); // on demarre la session

include './core.php';

//################ Inserting logging Information #############
// Method = 0 -- Login/Loggout     , Event =0 -- Login /1 Loggout
// Method = 1 -- Pause/Unpaus     , Event =0 -- Pause /1 Unpause

$dba->UploadEventInformation($_SESSION['ownerId'], 0, 1);

//############################################################

$page = "index.php";
if (isset($_SESSION['extension'])) {

    $page = "agents.php";
    $dba->UpdateAddDelSCCOnlineUser(3, $_SESSION['ownerId'], $_SESSION['ownerId'], $_SESSION['extension'], $lastUpdate, 0);
}

//$dba->deleteFromPresence($_SESSION['ownerId']);
//die();

unset($_SESSION['right']);

unset($_SESSION['identity']);

unset($_SESSION['login']);

unset($_SESSION['Identity']);

unset($_SESSION['telephone']);

session_unset();

session_destroy(); // on detruit la session en cours.

echo "<meta http-equiv='refresh' content='0;url=$page'  />";

/* $logoutGoTo = "index.php";

  header("Location: $logoutGoTo"); */

exit;
?> 