getTimestamp() . getRandomNumber(); } // cleanup account containers in session $cleanupCandidates = array(); foreach ($_SESSION as $key => $value) { if (strpos($key, $sessionAccountPrefix) === 0) { $cleanupCandidates[] = $key; } $candidateCount = sizeof($cleanupCandidates); if ($candidateCount > 100) { $numToDelete = $candidateCount - 100; natsort($cleanupCandidates); for ($i = 0; $i < $numToDelete; $i++) { $toDelete = array_shift($cleanupCandidates); unset($_SESSION[$toDelete]); } } } $typeManager = new LAM\TYPES\TypeManager(); //load account if (isset($_GET['DN'])) { $type = $typeManager->getConfiguredType($_GET['type']); $DN = str_replace("\\'", '', $_GET['DN']); if ($type->isHidden()) { logNewMessage(LOG_ERR, 'User tried to access hidden account type: ' . $type->getId()); die(); } if ($_GET['DN'] == $DN) { if (substr($DN, 0, 1) === "'") { $DN = substr($DN, 1); } if (substr($DN, -1, 1) === "'") { $DN = substr($DN, 0, -1); } } $suffix = strtolower($type->getSuffix()); $DNlower = strtolower($DN); if (strpos($DNlower, $suffix) !== (strlen($DNlower) - strlen($suffix))) { logNewMessage(LOG_ERR, 'User tried to access entry of type ' . $type->getId() . ' outside suffix ' . $suffix); die(); } $_SESSION[$sessionKey] = new accountContainer($type, $sessionKey); $result = $_SESSION[$sessionKey]->load_account($DN); if (sizeof($result) > 0) { include __DIR__ . '/../../lib/adminHeader.inc'; foreach ($result as $message) { call_user_func_array("StatusMessage", $message); } include __DIR__ . '/../../lib/adminFooter.inc'; die(); } } // new account elseif (empty($_POST)) { $type = $typeManager->getConfiguredType($_GET['type']); if ($type->isHidden()) { logNewMessage(LOG_ERR, 'User tried to access hidden account type: ' . $type->getId()); die(); } elseif (!checkIfNewEntriesAreAllowed($type->getId())) { logNewMessage(LOG_ERR, 'User tried to create entry of forbidden account type: ' . $type->getId()); die(); } $_SESSION[$sessionKey] = new accountContainer($type, $sessionKey); $_SESSION[$sessionKey]->new_account(); } // show account page $_SESSION[$sessionKey]->continue_main(); ?>