Rev 2168 | Rev 2493 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log
<?php
/**
* Print tickets of the new user
*
* @author Tom Houdayer
* @copyright Copyright (C) ALCASAR (http://www.alcasar.net)
* @license GPL-3.0
* @version $Id: ticket_user.php 2473 2017-12-30 00:37:45Z tom.houdayer $
*/
require_once __DIR__ . '/../lib/alcasar/TicketsGenerator.php';
$langue_imp = ((isset($_POST['langue_imp'])) ? $_POST['langue_imp'] : 'en');
require_once __DIR__ . '/../lib/langues_imp.php';
// Get datas from form
if ((!isset($_POST['log_imp'])) || (!isset($_POST['passwd_imp'])) || (!isset($_POST['exp_imp'])) || (!isset($_POST['sto_imp'])) || (!isset($_POST['mas_imp'])) || (!isset($_POST['mds_imp']))) {
exit();
}
$log_imp = $_POST['log_imp'];
$passwd_imp = $_POST['passwd_imp'];
$exp_imp = ((($_POST['exp_imp'] === '') || ($_POST['exp_imp'] === '-')) ? $l_without : utf8_decode($_POST['exp_imp']));
$sto_imp = ((($_POST['sto_imp'] === '') || ($_POST['sto_imp'] === '-')) ? $l_unlimited : utf8_decode($_POST['sto_imp']));
$mas_imp = ((($_POST['mas_imp'] === '') || ($_POST['mas_imp'] === '-')) ? $l_unlimited : utf8_decode($_POST['mas_imp']));
$mds_imp = ((($_POST['mds_imp'] === '') || ($_POST['mds_imp'] === '-')) ? $l_unlimited : utf8_decode($_POST['mds_imp']));
// Generate tickets
$ticketsGenerator = new TicketsGenerator(['language' => $langue_imp]);
// Add user
$ticketsGenerator->addTicket([
'username' => $log_imp,
'password' => $passwd_imp,
'maxAllSession' => $mas_imp,
'sessionTimeout' => $sto_imp,
'maxDailySession' => $mds_imp,
'expiration' => $exp_imp
]);
// Save the PDF and redirect user to it
$filename = 'ticket_' . $log_imp . '.pdf';
// Remove accents
$filename = strtr(utf8_decode($filename), utf8_decode('ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ'), 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'); // TODO : manage all UTF-8 chars
$ticketsGenerator->saveAs($filename);
header('Location: ' . $filename);