-FIX_DELETED_COOKIES(array('admin_login', 'admin_md5', 'admin_last', 'admin_to'));
-
-if (!defined('admin_registered')) {
- // Admin is not registered so we have to inform the user
- if ((isset($_POST['ok'])) && ((empty($_POST['login'])) || (empty($_POST['pass'])) || (strlen($_POST['pass']) < 4))) $_POST['ok'] = "***";
- if ((isset($_POST['ok'])) && ($_POST['ok'] != "***")) {
- // Hash the password with the old function because we are here in install mode
- $hashedPass = md5($_POST['pass']);
-
- // Kill maybe existing session variables
- set_session('admin_login' , "");
- set_session('admin_md5' , "");
- set_session('admin_last' , "");
- set_session('admin_to' , "");
-
- // Do registration
- $ret = REGISTER_ADMIN($_POST['login'], $hashedPass);
- switch ($ret)
- {
- case "done":
- admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
- if (!_FATAL) {
- // Registering is done
- LOAD_URL(URL."/modules.php?module=admin&action=login®ister=done");
- } else {
- $ret = ADMIN_CANNOT_COMPLETE;
- }
- break;
-
- case "failed":
- $ret = ADMIN_REGISTER_FAILED;
- break;
-
- case "already":
- default:
- if ($ret == "already") {
- // Admin does already exists!
- $ret = ADMIN_LOGIN_ALREADY_REG;
- } else {
- // Any other kind
- $ret = "done";
- }
-
- if (!defined('admin_registered')) {
- // Write to config that registration is done
- admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
-
- // Load URL for login
- $URL = URL."/modules.php?module=admin&action=login";
- LOAD_URL($URL);
- }
- break;
- }
- }