<?php

namespace App\Controllers;

use App\Core\Controller;

class AuthorSubmissionEntryController extends Controller
{
    public function enter()
    {
        $org_id = $_GET['org_id'] ?? null;
        $conference_id = $_GET['conference_id'] ?? ($_GET['id'] ?? null);

        if (!$conference_id) {
            die("Conference not specified.");
        }

        $_SESSION['submit_org_id'] = $org_id;
        $_SESSION['submit_conference_id'] = $conference_id;

        if (isset($_SESSION['user_id'])) {
            $_SESSION['org_id'] = $org_id;
            $_SESSION['conference_id'] = $conference_id;

            header("Location: /easychair/author/submit?id=" . (int)$conference_id);
            exit;
        }

        header("Location: /easychair/login");
        exit;
    }
}
