示例#1
0
        }
        $user_passwd = file_get_contents("../first_user");
        $user_passwd = explode(" , ", $user_passwd);
        $salt = substr($user_passwd[1], 0, 2);
        $cpasswd = crypt($passwd, $salt);
        $user_passwd[1] = rtrim($user_passwd[1]);
        $res = $login == $user_passwd[0] && $user_passwd[1] == $cpasswd;
        if (!$res) {
            $error = "Authentication failed";
            view_login_form();
            die;
        }
        $_SESSION['user_login'] = $login;
        $_SESSION['user_logged'] = true;
    } else {
        view_login_form();
        die;
    }
}
if (isset($input['install']) && !empty($input['install'])) {
    // saves organization logo if it exists
    save_logo();
    // installation form has been submitted and we verify the db to create the tables
    validate_form();
    create_config_files();
    require_once 'config.inc';
    add_first_user();
} else {
    if (isset($input['db_choice_submit']) && !empty($input['db_choice_submit'])) {
        // db already contains EZcast tables. The user has choosen whether he wants to
        // replace the existing tables, change the tables prefix or use the existing tables
示例#2
0
/**
 * Effectively logs the user in
 * @param string $login
 * @param string $passwd
 */
function user_login($login, $passwd)
{
    global $input;
    global $template_folder;
    global $error;
    global $ezadmin_url;
    // 0) Sanity checks
    if (empty($login) || empty($passwd)) {
        $error = template_get_message('empty_username_password', get_lang());
        view_login_form();
        die;
    }
    $login_parts = explode("/", $login);
    // checks if runas
    if (count($login_parts) >= 2) {
        $error = "No runas here !";
        view_login_form();
        die;
    }
    if (!file_exists('admin.inc')) {
        $error = "User not authorized";
        view_login_form();
        die;
    }
    include 'admin.inc';
    //file containing an assoc array of admin users
    if (!isset($users[$login_parts[0]])) {
        $error = "User not authorized";
        view_login_form();
        die;
    }
    $res = checkauth(strtolower($login), $passwd);
    if (!$res) {
        $error = checkauth_last_error();
        view_login_form();
        die;
    }
    // 1) Initializing session vars
    $_SESSION['podcastcours_logged'] = "LEtimin";
    // "boolean" stating that we're logged
    $_SESSION['user_login'] = $login;
    $_SESSION['user_real_login'] = $res['real_login'];
    $_SESSION['user_full_name'] = $res['full_name'];
    $_SESSION['user_email'] = $res['email'];
    // 3) Setting correct language
    set_lang($input['lang']);
    // 4) Resetting the template path to the one of the language chosen
    template_repository_path($template_folder . get_lang());
    // 5) Logging the login operation
    log_append("login");
    // 6) Displaying the page
    header("Location: " . $ezadmin_url);
    view_main();
}
示例#3
0
/**
 * Effectively logs the user in
 * @param string $login
 * @param string $passwd
 */
function user_login($login, $passwd)
{
    global $input;
    global $template_folder;
    global $error;
    global $ezplayer_url;
    // 0) Sanity checks
    if (empty($login) || empty($passwd)) {
        $error = template_get_message('empty_username_password', get_lang());
        view_login_form();
        die;
    }
    $login_parts = explode("/", $login);
    // checks if runas
    if (count($login_parts) == 2) {
        if (!file_exists('admin.inc')) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
        include 'admin.inc';
        //file containing an assoc array of admin users
        if (!isset($admin[$login_parts[0]])) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
        $_SESSION['user_is_admin'] = true;
        $_SESSION['user_runas'] = true;
    } else {
        if (file_exists('admin.inc')) {
            include 'admin.inc';
            //file containing an assoc array of admin users
            if (isset($admin[$login])) {
                $_SESSION['user_is_admin'] = true;
            }
        }
    }
    $res = checkauth(strtolower($login), $passwd);
    if (!$res) {
        $error = checkauth_last_error();
        view_login_form();
        die;
    }
    // 1) Initializing session vars
    $_SESSION['ezplayer_logged'] = "user_logged";
    // "boolean" stating that we're logged
    $_SESSION['user_login'] = $res['login'];
    $_SESSION['user_real_login'] = $res['real_login'];
    $_SESSION['user_full_name'] = $res['full_name'];
    $_SESSION['user_email'] = $res['email'];
    $_SESSION['admin_enabled'] = false;
    //check flash plugin or GET parameter no_flash
    if (!isset($_SESSION['has_flash'])) {
        //no noflash param when login
        //check flash plugin
        if ($input['has_flash'] == 'N') {
            $_SESSION['has_flash'] = false;
        } else {
            $_SESSION['has_flash'] = true;
        }
    }
    // 2) Initializing the ACLs
    acl_init($login);
    // 3) Setting correct language
    set_lang($input['lang']);
    // 4) Resetting the template path to the one of the language chosen
    template_repository_path($template_folder . get_lang());
    // 5) Logging the login operation
    log_append("login");
    log_append("user's browser : " . $_SESSION['browser_full']);
    // lvl, action, browser_name, browser_version, user_os, browser_full_info
    trace_append(array("1", "login", $_SESSION['browser_name'], $_SESSION['browser_version'], $_SESSION['user_os'], $_SESSION['browser_full'], session_id()));
    // 6) Displaying the page
    //    view_main();
    if (count($_SESSION['first_input']) > 0) {
        $ezplayer_url .= '/index.php?';
    }
    foreach ($_SESSION['first_input'] as $key => $value) {
        $ezplayer_url .= "{$key}={$value}&";
    }
    header("Location: " . $ezplayer_url);
    load_page();
}
示例#4
0
/**
 * Effectively logs the user in
 * @param string $login
 * @param string $passwd
 */
function user_login($login, $passwd)
{
    global $input;
    global $template_folder;
    global $error;
    global $ezmanager_url;
    // 0) Sanity checks
    if (empty($login) || empty($passwd)) {
        $error = template_get_message('empty_username_password', get_lang());
        view_login_form();
        die;
    }
    $login_parts = explode("/", $login);
    // checks if runas
    if (count($login_parts) == 2) {
        if (!file_exists('admin.inc')) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
        include 'admin.inc';
        //file containing an assoc array of admin users
        if (!isset($admin[$login_parts[0]])) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
    }
    $res = checkauth(strtolower($login), $passwd);
    if (!$res) {
        $error = checkauth_last_error();
        view_login_form();
        die;
    }
    // 1) Initializing session vars
    $_SESSION['podman_logged'] = "LEtimin";
    // "boolean" stating that we're logged
    $_SESSION['user_login'] = $res['login'];
    $_SESSION['user_real_login'] = $res['real_login'];
    $_SESSION['user_full_name'] = $res['full_name'];
    $_SESSION['user_email'] = $res['email'];
    //check flash plugin or GET parameter no_flash
    if (!isset($_SESSION['has_flash'])) {
        //no noflash param when login
        //check flash plugin
        if ($input['has_flash'] == 'N') {
            $_SESSION['has_flash'] = false;
        } else {
            $_SESSION['has_flash'] = true;
        }
    }
    // 2) Initializing the ACLs
    acl_init($login);
    // 3) Setting correct language
    set_lang($input['lang']);
    if (count(acl_authorized_albums_list()) == 0) {
        error_print_message(template_get_message('not_registered', get_lang()), false);
        log_append('warning', $res['login'] . ' tried to access ezmanager but doesn\'t have permission to manage any album.');
        session_destroy();
        view_login_form();
        die;
    }
    // 4) Resetting the template path to the one of the language chosen
    template_repository_path($template_folder . get_lang());
    // 5) Logging the login operation
    log_append("login");
    // 6) Displaying the page
    header("Location: " . $ezmanager_url);
    view_main();
}