function isSessionIDValid($config, $xsid)
{
    $bValid = false;
    //Instantiate the CR3DCQuery Class
    $oR3DCQuery = new CR3DCQuery($config);
    $oR3DCQuery->CheckSIDTimeout();
    if ($xsid != "") {
        if ($oR3DCQuery->CheckLogin($config, $xsid)) {
            $session = base64_decode($xsid);
            list($uniq, $player_id) = preg_split("/\\|/", $session);
            if ($uniq != "" && is_numeric($player_id)) {
                $bValid = true;
                $oR3DCQuery->UpdateSIDTimeout($config, $xsid);
                $oR3DCQuery->SetPlayerCreditsInit($player_id);
            }
        }
    }
    if ($oR3DCQuery->ELOIsActive()) {
        $oR3DCQuery->ELOCreateRatings();
    }
    $oR3DCQuery->MangeGameTimeOuts();
    $oR3DCQuery->Close();
    unset($oR3DCQuery);
    return $bValid;
}
$txtAbove = trim($_POST['txtAbove']);
$txtBelow = trim($_POST['txtBelow']);
$cmdSearchPoints = trim($_POST['cmdSearchPoints']);
//////////////////////////////////////////////////////////////
//Instantiate the CR3DCQuery Class
$oR3DCQuery = new CR3DCQuery($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//Check if the logged in user has access
if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) {
    $_SESSION['PageRef'] = $url;
    header('Location: ./chess_login.php');
} else {
    $oR3DCQuery->CheckSIDTimeout();
    if ($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false) {
        $_SESSION['PageRef'] = $url;
        header('Location: ./chess_login.php');
    } else {
        $_SESSION['PageRef'] = "";
        $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']);
        $oR3DCQuery->SetPlayerCreditsInit($_SESSION['id']);
    }
    if (!$bCronEnabled) {
        if ($oR3DCQuery->ELOIsActive()) {
            $oR3DCQuery->ELOCreateRatings();
        }
        $oR3DCQuery->MangeGameTimeOuts();
    }
}
///////////////////////////////////////////////////////////////////////