<?php

// ENREGISTREMENT
if (isset($_POST['savepassword'])) {
    $current = md5($_POST['changePasswordCurrent']);
    $new = md5($_POST['changePasswordNew']);
    if (isset($_SESSION['adminserv']['path'])) {
        $adminservPath = $_SESSION['adminserv']['path'];
    } else {
        $adminservPath = null;
    }
    $pathConfig = $adminservPath . 'config/';
    if (OnlineConfig::PASSWORD !== $current) {
        AdminServ::error(Utils::t('The current password doesn\'t match.'));
    } else {
        if (($result = AdminServServerConfig::savePasswordConfig($pathConfig . 'adminserv.cfg.php', $new)) !== true) {
            AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
        } else {
            $info = Utils::t('The password has been changed.');
            AdminServ::info($info);
            AdminServLogs::add('action', $info);
        }
    }
    Utils::redirection(false, '?p=' . USER_PAGE);
}
Exemple #2
0
         session_destroy();
         session_start();
         $_SESSION['adminserv']['allow_config_servers'] = true;
         if (OnlineConfig::ADD_ONLY === true || AdminServServerConfig::hasServer() === false) {
             Utils::redirection(false, '../?p=config-addserver');
         } else {
             Utils::redirection(false, '../?p=config-servers');
         }
     } else {
         AdminServ::error(Utils::t('You are not allowed to configure the servers'));
         Utils::redirection(false, '..');
     }
 } else {
     if (isset($_POST['configsavepassword'])) {
         $password = md5($_POST['savePassword']);
         if (($result = AdminServServerConfig::savePasswordConfig('./adminserv.cfg.php', $password)) !== true) {
             AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
             Utils::redirection(false, '..');
         } else {
             session_unset();
             session_destroy();
             session_start();
             $_SESSION['adminserv']['allow_config_servers'] = true;
             Utils::redirection(false, '../?p=config-addserver');
         }
     } else {
         // Création du mot de passe
         $_SESSION['adminserv']['get_password'] = true;
         Utils::redirection(false, '..');
     }
 }