• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phpbb_email_hash函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中phpbb_email_hash函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_email_hash函数的具体用法?PHP phpbb_email_hash怎么用?PHP phpbb_email_hash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了phpbb_email_hash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run_tool

    /**
     * Run the tool
     */
    function run_tool()
    {
        global $db, $template;
        $step = request_var('step', 0);
        // Select the batch
        $sql = 'SELECT user_id, user_email, user_email_hash
			FROM ' . USERS_TABLE;
        $result = $db->sql_query_limit($sql, $this->batch_size, $step * $this->batch_size);
        $batch = $db->sql_fetchrowset($result);
        $db->sql_freeresult($result);
        if (!$batch) {
            trigger_error('UPDATE_EMAIL_HASHES_COMPLETE');
        }
        foreach ($batch as $userrow) {
            $new_hash = phpbb_email_hash($userrow['user_email']);
            if ($userrow['user_email_hash'] == $new_hash) {
                // Skip if the hash hasn't changed
                continue;
            }
            // Update the field
            $sql = 'UPDATE ' . USERS_TABLE . " SET user_email_hash = '" . $new_hash . "'\n\t\t\t\tWHERE user_id = " . $userrow['user_id'];
            $db->sql_query($sql);
        }
        meta_refresh(0, append_sid(STK_INDEX, array('c' => 'support', 't' => 'update_email_hashes', 'submit' => true, 'step' => ++$step)));
        $template->assign_var('U_BACK_TOOL', false);
        trigger_error('UPDATE_EMAIL_HASHES_NOT_COMPLETE');
    }
开发者ID:napus,项目名称:support-toolkit,代码行数:30,代码来源:update_email_hashes.php


示例2: onEdit

 function onEdit($record, $old_record)
 {
     $auth_model = Configure::read('security.auth_model');
     $username_field = $this->_controller->Auth->authenticate->userField;
     $email_field = $this->_controller->Auth->authenticate->emailField;
     // phpBB3 files need these
     global $phpbb_root_path, $phpEx;
     $phpbb_root_path = Configure::read('phpbb3.root_path');
     $phpEx = 'php';
     include $phpbb_root_path . 'config.php';
     $bb3_class = "{$table_prefix}users";
     $bb3_model = ClassRegistry::init($bb3_class);
     $bb3_user = $bb3_model->find('first', array('conditions' => array('username' => $old_record[$auth_model][$username_field])));
     // We only care about username and email address changes
     if (empty($bb3_user) || $bb3_user[$bb3_class]['username'] == $record[$auth_model][$username_field] && $bb3_user[$bb3_class]['user_email'] == $record[$auth_model][$email_field]) {
         return;
     }
     // Includ a couple of things needed for function definitions
     define('IN_PHPBB', true);
     include $phpbb_root_path . 'includes/functions.php';
     include $phpbb_root_path . 'includes/utf/utf_tools.php';
     $clean = utf8_clean_string($record[$auth_model][$username_field]);
     $hash = phpbb_email_hash($record[$auth_model][$email_field]);
     $bb3_model->updateAll(array('username' => "'{$record[$auth_model][$username_field]}'", 'username_clean' => "'{$clean}'", 'user_email' => "'{$record[$auth_model][$email_field]}'", 'user_email_hash' => "'{$hash}'"), array('user_id' => $bb3_user[$bb3_class]['user_id']));
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:25,代码来源:user_phpbb3.php


示例3: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template, $phpbb_container;
        if (!$config['allow_password_reset']) {
            trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
        }
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new \phpbb\auth\auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            // Make password at least 8 characters long, make it longer if admin wants to.
            // gen_rand_string() however has a limit of 12 or 13.
            $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
            // For the activation key a random length between 6 and 10 will do.
            $user_actkey = gen_rand_string(mt_rand(6, 10));
            // Instantiate passwords manager
            $passwords_manager = $phpbb_container->get('passwords.manager');
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->set_addresses($user_row);
            $messenger->anti_abuse_headers($config, $user);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:60,代码来源:ucp_remind.php


示例4: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            $key_len = 54 - strlen($server_url);
            $key_len = max(6, $key_len);
            // we want at least 6
            $key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
            // we want at most $config['max_pass_chars']
            $user_actkey = substr(gen_rand_string(10), 0, $key_len);
            $user_password = gen_rand_string(8);
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->to($user_row['user_email'], $user_row['username']);
            $messenger->im($user_row['user_jabber'], $user_row['username']);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
开发者ID:puring0815,项目名称:OpenKore,代码行数:57,代码来源:ucp_remind.php


示例5: login_with_email

    public function login_with_email($event)
    {
        if (!defined('ADMIN_START') && $this->config['allow_email_login']) {
            $user_email = $event['username_clean'];
            if (!phpbb_validate_email($user_email)) {
                $sql = $event['sql'];
                $sql = 'SELECT *
					FROM ' . USERS_TABLE . "\n\t\t\t\t\tWHERE user_email_hash = '" . phpbb_email_hash($user_email) . "'";
                $event['sql'] = $sql;
            }
        }
    }
开发者ID:ForumHulp,项目名称:loginwithemail,代码行数:12,代码来源:listener.php


示例6: execute

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $sql = 'SELECT user_id, user_email, user_email_hash
			FROM ' . USERS_TABLE . '
			WHERE user_type <> ' . USER_IGNORE . "\n\t\t\t\tAND user_email <> ''";
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $user_email_hash = phpbb_email_hash($row['user_email']);
            if ($user_email_hash !== $row['user_email_hash']) {
                $sql_ary = array('user_email_hash' => $user_email_hash);
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
					WHERE user_id = ' . (int) $row['user_id'];
                $this->db->sql_query($sql);
                if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) {
                    $output->writeln(sprintf('user_id %d, email %s => %s', $row['user_id'], $row['user_email'], $user_email_hash));
                }
            }
        }
        $this->db->sql_freeresult($result);
        $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>');
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:22,代码来源:recalculate_email_hash.php


示例7: array

 // PROFILE EDIT BRIDGE - BEGIN
 $target_profile_data = array('user_id' => $user_id, 'username' => $username, 'password' => $new_password, 'email' => $email);
 // PROFILE EDIT BRIDGE - END
 $user_allow_pm = !empty($config['user_allow_pm_register']) ? 1 : 0;
 $sn_im_sql_fields = '';
 $sn_im_sql_data = '';
 $user_sn_im_array = get_user_sn_im_array();
 foreach ($user_sn_im_array as $k => $v) {
     $sn_im_sql_fields .= ", " . $v['field'];
     $sn_im_sql_data .= ", '" . $db->sql_escape(str_replace(' ', '+', trim(${$v}['form']))) . "'";
 }
 // UPI2DB - EDIT
 // IN LINE ADD
 // , user_upi2db_which_system, user_upi2db_new_word, user_upi2db_edit_word, user_upi2db_unread_color
 // , $upi2db_which_system, $upi2db_new_word, $upi2db_edit_word, $upi2db_unread_color
 $sql = "INSERT INTO " . USERS_TABLE . " (user_registered_ip, user_registered_hostname, user_id, username, username_clean, user_regdate, user_password, user_email, user_email_hash, user_website, user_occ, user_from, user_from_flag, user_first_name, user_last_name, user_interests, user_phone, user_selfdes, user_profile_view_popup, user_sig, user_avatar, user_avatar_type, user_allow_viewemail, user_upi2db_which_system, user_upi2db_new_word, user_upi2db_edit_word, user_upi2db_unread_color" . $sn_im_sql_fields . ", user_attachsig, user_allowsmile, user_showavatars, user_showsignatures, user_allowswearywords, user_allowhtml, user_allowbbcode, user_allow_pm_in, user_allow_mass_email, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_time_mode, user_dst_time_lag, user_dateformat, user_posts_per_page, user_topics_per_page, user_hot_threshold, user_topic_show_days, user_topic_sortby_type, user_topic_sortby_dir, user_post_show_days, user_post_sortby_type, user_post_sortby_dir, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_birthday_y, user_birthday_m, user_birthday_d, user_next_birthday_greeting, user_facebook_id, user_active, user_actkey)\n\t\t\t\tVALUES ('" . $db->sql_escape($user_registered_ip) . "', '" . $db->sql_escape($user_registered_hostname) . "', {$user_id}, '" . $db->sql_escape($username) . "', '" . $db->sql_escape(utf8_clean_string($username)) . "', " . time() . ", '" . $db->sql_escape(phpbb_hash($new_password)) . "', '" . $db->sql_escape($email) . "', '" . $db->sql_escape(phpbb_email_hash($email)) . "', '" . $db->sql_escape($website) . "', '" . $db->sql_escape($occupation) . "', '" . $db->sql_escape($location) . "', '{$user_flag}', '" . $db->sql_escape($user_first_name) . "', '" . $db->sql_escape($user_last_name) . "', '" . $db->sql_escape($interests) . "', '" . $db->sql_escape($phone) . "', '" . $db->sql_escape($selfdes) . "', {$profile_view_popup}, '" . $db->sql_escape($signature) . "', {$avatar_sql}, {$viewemail}, {$upi2db_which_system}, {$upi2db_new_word}, {$upi2db_edit_word}, {$upi2db_unread_color}" . $sn_im_sql_data . ", {$attachsig}, {$allowsmilies}, {$showavatars}, {$showsignatures}, {$allowswearywords}, {$allowhtml}, {$allowbbcode}, {$allowpmin}, {$allowmassemail}, {$allowviewonline}, {$notifyreply}, {$notifypm}, {$popup_pm}, {$user_timezone}, {$time_mode}, {$dst_time_lag}, '" . $db->sql_escape($user_dateformat) . "', '" . $db->sql_escape($user_posts_per_page) . "', '" . $db->sql_escape($user_topics_per_page) . "', '" . $db->sql_escape($user_hot_threshold) . "', '" . $db->sql_escape($user_topic_show_days) . "', '" . $db->sql_escape($user_topic_sortby_type) . "', '" . $db->sql_escape($user_topic_sortby_dir) . "', '" . $db->sql_escape($user_post_show_days) . "', '" . $db->sql_escape($user_post_sortby_type) . "', '" . $db->sql_escape($user_post_sortby_dir) . "', '" . $db->sql_escape($user_lang) . "', {$user_style}, '{$gender}', 0, {$user_allow_pm}, '{$birthday}', '{$birthday_year}', '{$birthday_month}', '{$birthday_day}', '{$next_birthday_greeting}', '{$user_facebook_id}', ";
 if ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa) {
     $user_actkey = gen_rand_string();
     //$key_len = 54 - (strlen($server_url));
     $key_len = 54 - strlen($profile_server_url);
     $key_len = $key_len > 6 ? $key_len : 6;
     $user_actkey = substr($user_actkey, 0, $key_len);
     $sql .= "0, '" . $db->sql_escape($user_actkey) . "')";
 } else {
     $sql .= "1, '')";
 }
 $db->sql_transaction('begin');
 $result = $db->sql_query($sql);
 // CrackerTracker v5.x
 // BEGIN CrackerTracker v5.x
 $mode == 'register' ? $profile_security->pw_create_date($user_id) : null;
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:31,代码来源:usercp_register.php


示例8: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        add_form_key('ucp_resend');
        if ($submit) {
            if (!check_form_key('ucp_resend')) {
                trigger_error('FORM_INVALID');
            }
            $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE) {
                trigger_error('ACCOUNT_ALREADY_ACTIVATED');
            }
            if (!$user_row['user_actkey'] || $user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                trigger_error('ACCOUNT_DEACTIVATED');
            }
            // Determine coppa status on group (REGISTERED(_COPPA))
            $sql = 'SELECT group_name, group_type
				FROM ' . GROUPS_TABLE . '
				WHERE group_id = ' . $user_row['group_id'];
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$row) {
                trigger_error('NO_GROUP');
            }
            $coppa = $row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL ? true : false;
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) {
                $messenger->template($coppa ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']);
                $messenger->set_addresses($user_row);
                $messenger->anti_abuse_headers($config, $user);
                $messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_ACTIVATE' => generate_board_url() . "/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}"));
                if ($coppa) {
                    $messenger->assign_vars(array('FAX_INFO' => $config['coppa_fax'], 'MAIL_INFO' => $config['coppa_mail'], 'EMAIL_ADDRESS' => $user_row['user_email']));
                }
                $messenger->send(NOTIFY_EMAIL);
            }
            if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
                // Grab an array of user_id's with a_user permissions ... these users can activate a user
                $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
					FROM ' . USERS_TABLE . '
					WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']);
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $messenger->template('admin_activate', $row['user_lang']);
                    $messenger->set_addresses($row);
                    $messenger->anti_abuse_headers($config, $user);
                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_USER_DETAILS' => generate_board_url() . "/memberlist.{$phpEx}?mode=viewprofile&u={$user_row['user_id']}", 'U_ACTIVATE' => generate_board_url() . "/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}"));
                    $messenger->send($row['user_notify_type']);
                }
                $db->sql_freeresult($result);
            }
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $config['require_activation'] == USER_ACTIVATION_ADMIN ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
            $message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act')));
        $this->tpl_name = 'ucp_resend';
        $this->page_title = 'UCP_RESEND';
    }
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:77,代码来源:ucp_resend.php


示例9: validate_email

/**
* Check to see if email address is banned or already present in the DB
*
* @param string $email The email to check
* @param string $allowed_email An allowed email, default being $user->data['user_email']
*
* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
*/
function validate_email($email, $allowed_email = false)
{
    global $config, $db, $user;
    $email = strtolower($email);
    $allowed_email = $allowed_email === false ? strtolower($user->data['user_email']) : strtolower($allowed_email);
    if ($allowed_email == $email) {
        return false;
    }
    if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) {
        return 'EMAIL_INVALID';
    }
    // Check MX record.
    // The idea for this is from reading the UseBB blog/announcement. :)
    if ($config['email_check_mx']) {
        list(, $domain) = explode('@', $email);
        if (phpbb_checkdnsrr($domain, 'A') === false && phpbb_checkdnsrr($domain, 'MX') === false) {
            return 'DOMAIN_NO_MX_RECORD';
        }
    }
    if (($ban_reason = $user->check_ban(false, false, $email, true)) !== false) {
        return $ban_reason === true ? 'EMAIL_BANNED' : $ban_reason;
    }
    if (!$config['allow_emailreuse']) {
        $sql = 'SELECT user_email_hash
			FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_email_hash = " . $db->sql_escape(phpbb_email_hash($email));
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if ($row) {
            return 'EMAIL_TAKEN';
        }
    }
    return false;
}
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:42,代码来源:functions_user.php


示例10: md5

$changingEmail = false;
if (strlen($pwd) > 0) {
    $changingPwd = true;
}
if ($oldEmail != $email) {
    $changingEmail = true;
}
//$password = md5($pwd);
$password = md5($pwd);
//get the userid for the (old) email address
$user_id_ary = NULL;
$user_name_ary = array($username);
user_get_id_name($user_id_ary, $user_name_ary);
$phpbb_user_id = $user_id_ary[0];
echo 'username: ', $username, ' userid: ', $user_id_ary[0];
//update the user
$aSql = array();
if ($changingPwd) {
    $aSql["user_password"] = phpbb_hash($pwd);
    $aSql["user_passchg"] = time();
}
if ($changingEmail) {
    $aSql["user_email"] = $email;
    $aSql["user_email_hash"] = phpbb_email_hash($email);
}
// Execute update
$sql = 'UPDATE ' . USERS_TABLE . '
            SET ' . $db->sql_build_array('UPDATE', $aSql) . '
            WHERE user_id= ' . $phpbb_user_id;
$db->sql_query($sql);
echo 'OK';
开发者ID:bhccwebmaster,项目名称:citywildlife,代码行数:31,代码来源:phpbb_updateuser.php


示例11: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->db->sql_return_on_error(true);
     $server_name = $this->install_config->get('server_name');
     $current_time = time();
     $user_ip = phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR'));
     $user_ip = $user_ip === false ? '' : $user_ip;
     $referer = $this->iohandler->get_server_variable('REFERER');
     // Calculate cookie domain
     $cookie_domain = $server_name;
     if (strpos($cookie_domain, 'www.') === 0) {
         $cookie_domain = substr($cookie_domain, 3);
     }
     // Set default config and post data, this applies to all DB's
     $sql_ary = array('INSERT INTO ' . $this->config_table . " (config_name, config_value)\n\t\t\t\tVALUES ('board_startdate', '{$current_time}')", 'INSERT INTO ' . $this->config_table . " (config_name, config_value)\n\t\t\t\tVALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('img_imagick')) . "'\n\t\t\t\tWHERE config_name = 'img_imagick'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "'\n\t\t\t\tWHERE config_name = 'server_name'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('server_port')) . "'\n\t\t\t\tWHERE config_name = 'server_port'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "'\n\t\t\t\tWHERE config_name = 'board_email'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "'\n\t\t\t\tWHERE config_name = 'board_contact'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($cookie_domain) . "'\n\t\t\t\tWHERE config_name = 'cookie_domain'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "'\n\t\t\t\tWHERE config_name = 'default_dateformat'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('email_enable')) . "'\n\t\t\t\tWHERE config_name = 'email_enable'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_delivery')) . "'\n\t\t\t\tWHERE config_name = 'smtp_delivery'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "'\n\t\t\t\tWHERE config_name = 'smtp_host'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_port')) . "'\n\t\t\t\tWHERE config_name = 'smtp_port'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "'\n\t\t\t\tWHERE config_name = 'smtp_auth_method'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_user')) . "'\n\t\t\t\tWHERE config_name = 'smtp_username'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_pass')) . "'\n\t\t\t\tWHERE config_name = 'smtp_password'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('cookie_secure')) . "'\n\t\t\t\tWHERE config_name = 'cookie_secure'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('force_server_vars')) . "'\n\t\t\t\tWHERE config_name = 'force_server_vars'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('script_path')) . "'\n\t\t\t\tWHERE config_name = 'script_path'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('server_protocol')) . "'\n\t\t\t\tWHERE config_name = 'server_protocol'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'\n\t\t\t\tWHERE config_name = 'newest_username'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . md5(mt_rand()) . "'\n\t\t\t\tWHERE config_name = 'avatar_salt'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . md5(mt_rand()) . "'\n\t\t\t\tWHERE config_name = 'plupload_salt'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('board_name')) . "'\n\t\t\t\tWHERE config_name = 'sitename'", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->install_config->get('board_description')) . "'\n\t\t\t\tWHERE config_name = 'site_desc'", 'UPDATE ' . $this->user_table . "\n\t\t\t\tSET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',\n\t\t\t\t\tuser_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "',\n\t\t\t\t\tuser_ip = '" . $this->db->sql_escape($user_ip) . "',\n\t\t\t\t\tuser_lang = '" . $this->db->sql_escape($this->install_config->get('user_language', 'en')) . "',\n\t\t\t\t\tuser_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "',\n\t\t\t\t\tuser_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "',\n\t\t\t\t\tuser_email_hash = " . $this->db->sql_escape(phpbb_email_hash($this->install_config->get('board_email'))) . ",\n\t\t\t\t\tusername_clean = '" . $this->db->sql_escape(utf8_clean_string($this->install_config->get('admin_name'))) . "'\n\t\t\t\tWHERE username = 'Admin'", 'UPDATE ' . $this->moderator_cache_table . "\n\t\t\t\tSET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'\n\t\t\t\tWHERE username = 'Admin'", 'UPDATE ' . $this->forums_table . "\n\t\t\t\tSET forum_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'\n\t\t\t\tWHERE forum_last_poster_name = 'Admin'", 'UPDATE ' . $this->topics_table . "\n\t\t\t\tSET topic_first_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',\n\t\t\t\ttopic_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'\n\t\t\t\tWHERE topic_first_poster_name = 'Admin'\n\t\t\t\t\tOR topic_last_poster_name = 'Admin'", 'UPDATE ' . $this->user_table . "\n\t\t\t\tSET user_regdate = {$current_time}", 'UPDATE ' . $this->posts_table . "\n\t\t\t\tSET post_time = {$current_time}, poster_ip = '" . $this->db->sql_escape($user_ip) . "'", 'UPDATE ' . $this->topics_table . "\n\t\t\t\tSET topic_time = {$current_time}, topic_last_post_time = {$current_time}", 'UPDATE ' . $this->forums_table . "\n\t\t\t\tSET forum_last_post_time = {$current_time}", 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '" . $this->db->sql_escape($this->db->sql_server_info(true)) . "'\n\t\t\t\tWHERE config_name = 'dbms_version'");
     if (@extension_loaded('gd')) {
         $sql_ary[] = 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = 'core.captcha.plugins.gd'\n\t\t\t\tWHERE config_name = 'captcha_plugin'";
         $sql_ary[] = 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '1'\n\t\t\t\tWHERE config_name = 'captcha_gd'";
     }
     $ref = substr($referer, strpos($referer, '://') + 3);
     if (!(stripos($ref, $server_name) === 0)) {
         $sql_ary[] = 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '0'\n\t\t\t\tWHERE config_name = 'referer_validation'";
     }
     // We set a (semi-)unique cookie name to bypass login issues related to the cookie name.
     $cookie_name = 'phpbb3_';
     $rand_str = md5(mt_rand());
     $rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35));
     $rand_str = substr($rand_str, 0, 5);
     $cookie_name .= strtolower($rand_str);
     $sql_ary[] = 'UPDATE ' . $this->config_table . "\n\t\t\tSET config_value = '" . $this->db->sql_escape($cookie_name) . "'\n\t\t\tWHERE config_name = 'cookie_name'";
     // Disable avatars if upload directory is not writable
     if (!$this->filesystem->is_writable($this->phpbb_root_path . 'images/avatars/upload/')) {
         $sql_ary[] = 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '0'\n\t\t\t\tWHERE config_name = 'allow_avatar'";
         $sql_ary[] = 'UPDATE ' . $this->config_table . "\n\t\t\t\tSET config_value = '0'\n\t\t\t\tWHERE config_name = 'allow_avatar_upload'";
     }
     $i = $this->install_config->get('add_config_settings_index', 0);
     $total = sizeof($sql_ary);
     $sql_ary = array_slice($sql_ary, $i);
     foreach ($sql_ary as $sql) {
         if (!$this->db->sql_query($sql)) {
             $error = $this->db->sql_error($this->db->get_sql_error_sql());
             $this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
         }
         $i++;
         // Stop execution if resource limit is reached
         if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) {
             break;
         }
     }
     if ($i < $total) {
         $this->install_config->set('add_config_settings_index', $i);
         throw new resource_limit_reached_exception();
     }
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:57,代码来源:add_config_settings.php


示例12: main

    function main($id, $mode)
    {
        global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
        global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
        $user->add_lang('posting');
        $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
        $delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
        $error = $data = array();
        $s_hidden_fields = '';
        switch ($mode) {
            case 'reg_details':
                $data = array('username' => $request->variable('username', $user->data['username'], true), 'email' => strtolower($request->variable('email', $user->data['user_email'])), 'new_password' => $request->variable('new_password', '', true), 'cur_password' => $request->variable('cur_password', '', true), 'password_confirm' => $request->variable('password_confirm', '', true));
                /**
                 * Modify user registration data on editing account settings in UCP
                 *
                 * @event core.ucp_profile_reg_details_data
                 * @var	array	data		Array with current or updated user registration data
                 * @var	bool	submit		Flag indicating if submit button has been pressed
                 * @since 3.1.4-RC1
                 */
                $vars = array('data', 'submit');
                extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_data', compact($vars)));
                add_form_key('ucp_reg_details');
                if ($submit) {
                    // Do not check cur_password, it is the old one.
                    $check_ary = array('new_password' => array(array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), array('password')), 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('user_email')));
                    if ($auth->acl_get('u_chgname') && $config['allow_namechange']) {
                        $check_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username'));
                    }
                    $error = validate_data($data, $check_ary);
                    if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) {
                        $error[] = $data['password_confirm'] ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';
                    }
                    // Instantiate passwords manager
                    /* @var $passwords_manager \phpbb\passwords\manager */
                    $passwords_manager = $phpbb_container->get('passwords.manager');
                    // Only check the new password against the previous password if there have been no errors
                    if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) {
                        $error[] = 'SAME_PASSWORD_ERROR';
                    }
                    if (!$passwords_manager->check($data['cur_password'], $user->data['user_password'])) {
                        $error[] = $data['cur_password'] ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';
                    }
                    if (!check_form_key('ucp_reg_details')) {
                        $error[] = 'FORM_INVALID';
                    }
                    /**
                     * Validate user data on editing registration data in UCP
                     *
                     * @event core.ucp_profile_reg_details_validate
                     * @var	array	data			Array with user profile data
                     * @var	bool	submit			Flag indicating if submit button has been pressed
                     * @var array	error			Array of any generated errors
                     * @since 3.1.4-RC1
                     */
                    $vars = array('data', 'submit', 'error');
                    extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars)));
                    if (!sizeof($error)) {
                        $sql_ary = array('username' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? $data['username'] : $user->data['username'], 'username_clean' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => $auth->acl_get('u_chgemail') ? $data['email'] : $user->data['user_email'], 'user_email_hash' => $auth->acl_get('u_chgemail') ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], 'user_password' => $auth->acl_get('u_chgpasswd') && $data['new_password'] ? $passwords_manager->hash($data['new_password']) : $user->data['user_password'], 'user_passchg' => $auth->acl_get('u_chgpasswd') && $data['new_password'] ? time() : 0);
                        if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) {
                            $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array('reportee_id' => $user->data['user_id'], $user->data['username'], $data['username']));
                        }
                        if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !$passwords_manager->check($data['new_password'], $user->data['user_password'])) {
                            $user->reset_login_keys();
                            $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array('reportee_id' => $user->data['user_id'], $user->data['username']));
                        }
                        if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) {
                            $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array('reportee_id' => $user->data['user_id'], $user->data['username'], $data['user_email'], $data['email']));
                        }
                        $message = 'PROFILE_UPDATED';
                        if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) {
                            $message = $config['require_activation'] == USER_ACTIVATION_SELF ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
                            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                            $server_url = generate_board_url();
                            $user_actkey = gen_rand_string(mt_rand(6, 10));
                            $messenger = new messenger(false);
                            $template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive' : 'user_activate';
                            $messenger->template($template_file, $user->data['user_lang']);
                            $messenger->to($data['email'], $data['username']);
                            $messenger->anti_abuse_headers($config, $user);
                            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                            $messenger->send(NOTIFY_EMAIL);
                            if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
                                // Grab an array of user_id's with a_user permissions ... these users can activate a user
                                $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                                $admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
                                // Also include founders
                                $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
                                if (sizeof($admin_ary)) {
                                    $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
                                }
                                $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
									FROM ' . USERS_TABLE . ' ' . $where_sql;
                                $result = $db->sql_query($sql);
                                while ($row = $db->sql_fetchrow($result)) {
                                    $messenger->template('admin_activate', $row['user_lang']);
                                    $messenger->set_addresses($row);
                                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_USER_DETAILS' => "{$server_url}/memberlist.{$phpEx}?mode=viewprofile&u={$user->data['user_id']}", 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                                    $messenger->send($row['user_notify_type']);
                                }
//.........这里部分代码省略.........
开发者ID:hgchen,项目名称:phpbb,代码行数:101,代码来源:ucp_profile.php


示例13: main

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP phpbb_filter_root_path函数代码示例发布时间:2022-05-15
下一篇:
PHP phpbb_clean_username函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap