<?php

require_once '../QueueIT.Security/SessionValidationController.php';
use QueueIT\Security\SessionValidationController, QueueIT\Security\ExpiredValidationException, QueueIT\Security\SessionValidateResultRepository, QueueIT\Security\KnownUserValidationException, QueueIT\Security\AcceptedConfirmedResult;
//session_start();
//SessionValidationController::configure(null, function () { return new SessionValidateResultRepository();});
try {
    $result = SessionValidationController::validateRequest('ticketania', $_GET['eventid']);
    if ($result instanceof AcceptedConfirmedResult) {
        $result->cancel();
    }
} catch (ExpiredValidationException $ex) {
    // Known user has has expired - Show error page and use GetCancelUrl to get user back in the queue
    header('Location: error.php?queuename=default&t=' . urlencode($ex->getKnownUser()->getOriginalUrl()));
} catch (KnownUserValidationException $ex) {
    // Known user is invalid - Show error page and use GetCancelUrl to get user back in the queue
    header('Location: error.php?queuename=default&t=' + urlencode($ex->previous->getOriginalUrl()));
}
//Buffer larger content areas like the main page content
ob_start();
?>
    <h3>Cancel validation result</h3>
    <p>Your validation result has been canceled</p>
	
<?php 
//Assign all Page Specific variables
$body = ob_get_contents();
ob_end_clean();
$title = "Cancel Validation";
//Apply the template
include "master.php";
<?php

require_once '../QueueIT.Security/SessionValidationController.php';
require_once 'CurrentBaseUrl.php';
use QueueIT\Security\SessionValidationController, QueueIT\Security\ExpiredValidationException, QueueIT\Security\KnownUserValidationException, QueueIT\Security\AcceptedConfirmedResult, QueueIT\Security\EnqueueResult;
try {
    $result = SessionValidationController::validateRequestFromConfiguration();
    // Check if user must be enqueued
    if ($result instanceof EnqueueResult) {
        header('Location: ' . $result->getRedirectUrl());
    }
    if ($result instanceof AcceptedConfirmedResult) {
        $cancelLink = $result->getQueue()->getCancelUrl(currentBaseUrl() . '/cancel.php?eventid=' . $result->getQueue()->getEventId());
    }
} catch (ExpiredValidationException $ex) {
    // Known user has has expired - Show error page and use GetCancelUrl to get user back in the queue
    header('Location: error.php?queuename=default&t=' . urlencode($ex->getKnownUser()->getOriginalUrl()));
} catch (KnownUserValidationException $ex) {
    // Known user is invalid - Show error page and use GetCancelUrl to get user back in the queue
    header('Location: error.php?queuename=default&t=' . urlencode($ex->getPrevious()->getOriginalUrl()));
}
//Buffer larger content areas like the main page content
ob_start();
?>
    <h3>Setting up the queue:</h3>
    <ol class="round">
        <li class="one">
            <h5>Add configuration section to queueit.ini config file</h5>
            This example uses the queue with name &#39;default&#39; from the web config file. The 
            entry contains the minimum required attributes.</li>
        <li class="two">
<?php

require_once '../QueueIT.Security/SessionValidationController.php';
require_once 'CurrentBaseUrl.php';
use QueueIT\Security\SessionValidationController, QueueIT\Security\KnownUserFactory, QueueIT\Security\ExpiredValidationException, QueueIT\Security\KnownUserValidationException, QueueIT\Security\AcceptedConfirmedResult, QueueIT\Security\EnqueueResult;
KnownUserFactory::configure('a774b1e2-8da7-4d51-b1a9-7647147bb13bace77210-a488-4b6f-afc9-8ba94551a7d7');
try {
    $result = SessionValidationController::validateRequest('ticketania', 'codeonly', true);
    // Check if user must be enqueued
    if ($result instanceof EnqueueResult) {
        header('Location: ' . $result->getRedirectUrl());
    }
    if ($result instanceof AcceptedConfirmedResult) {
        $cancelLink = $result->getQueue()->getCancelUrl(currentBaseUrl() . '/cancel.php?eventid=' . $result->getQueue()->getEventId());
    }
} catch (ExpiredValidationException $ex) {
    // Known user has has expired - Show error page and use GetCancelUrl to get user back in the queue
    header('Location: error.php?queuename=default&t=' . urlencode($ex->getKnownUser()->getOriginalUrl()));
} catch (KnownUserValidationException $ex) {
    // Known user is invalid - Show error page and use GetCancelUrl to get user back in the queue
    header('Location: error.php?queuename=default&t=' . urlencode($ex->getPrevious()->getOriginalUrl()));
}
//Buffer larger content areas like the main page content
ob_start();
?>
    <h3>Setting up the queue:</h3>
    <ol class="round">
        <li class="one">
            <h5>Add configuration using code</h5>
            All configuration that is supported using the configuration section is also 
            supported in code. In this example it is configured in the