コード例 #1
0
##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by James Hunt
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
if ($user) {
    if (!defined('SYS_USERS')) {
        require_once 'subsystems/users.php';
    }
    $user = exponent_users_update($_POST, $user);
    $user = exponent_users_saveUser($user);
    $user = exponent_users_saveProfileExtensions($_POST, $user, false);
    $_SESSION[SYS_SESSION_KEY]['user'] = $user;
    exponent_flow_redirect();
} else {
    echo SITE_403_HTML;
}
コード例 #2
0
} else {
    $newpass = '';
    for ($i = 0; $i < rand(12, 20); $i++) {
        $num = rand(48, 122);
        if ($num > 97 && $num < 122 || $num > 65 && $num < 90 || $num > 48 && $num < 57) {
            $newpass .= chr($num);
        } else {
            $i--;
        }
    }
    // Send message
    if (!defined('SYS_SMTP')) {
        require_once BASE . 'subsystems/smtp.php';
    }
    $e_template = new template('loginmodule', '_email_resetdone', $loc);
    $e_template->assign('newpass', $newpass);
    $msg = $e_template->render();
    if (!defined('SYS_USERS')) {
        require_once BASE . 'subsystems/users.php';
    }
    $u = exponent_users_getUserById($tok->uid);
    if (!exponent_smtp_mail($u->email, $i18n['from_name'] . ' <' . $i18n['from_email'] . '@' . HOSTNAME . '>', $i18n['title'], $msg)) {
        echo $i18n['smtp_error'];
    } else {
        // Save new password
        $u->password = md5($newpass);
        exponent_users_saveUser($u);
        $db->delete('passreset_token', 'uid=' . $tok->uid);
        echo $i18n['sent'];
    }
}
コード例 #3
0
            $suffix = "";
            while (exponent_users_getUserByName($userinfo->username . $suffix) != null) {
                //username already exists
                if (isset($_POST["update"]) == 1) {
                    if (in_array($userinfo->username, $usersdone)) {
                        $suffix = rand(100, 999);
                        $userinfo->changed = 1;
                    } else {
                        $tmp = exponent_users_getUserByName($userinfo->username . $suffix);
                        $userinfo->id = $tmp->id;
                        break;
                    }
                } else {
                    $suffix = rand(100, 999);
                    $userinfo->changed = 1;
                }
            }
            $userinfo->username = $userinfo->username . $suffix;
            $userarray[] = exponent_users_saveUser($userinfo);
            $usersdone[] = $userinfo->username;
        } else {
            $userinfo->linenum = $linenum;
            $userarray[] = $userinfo;
        }
    }
    $linenum++;
}
$template = new Template("importer", "_usercsv_display_users");
$template->assign("userarray", $userarray);
$template->output();
unlink(BASE . $_POST["filename"]);