當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IPSMember::makePassword方法代碼示例

本文整理匯總了PHP中IPSMember::makePassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::makePassword方法的具體用法?PHP IPSMember::makePassword怎麽用?PHP IPSMember::makePassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IPSMember的用法示例。


在下文中一共展示了IPSMember::makePassword方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: registerProcessForm


//.........這裏部分代碼省略.........
                 break;
                 /* Approve the account, but ban it */
             /* Approve the account, but ban it */
             case 3:
                 $member['member_banned'] = 1;
                 $member['bw_is_spammer'] = 1;
                 $this->settings['reg_auth_type'] = '';
                 break;
                 /* Deny registration */
             /* Deny registration */
             case 4:
                 $this->registry->output->showError('spam_denied_account', '100x001', FALSE, '', 200);
                 break;
         }
     }
     //-----------------------------------------
     // Create the account
     //-----------------------------------------
     $member = IPSMember::create(array('members' => $member, 'pfields_content' => $custom_fields->out_fields), FALSE, FALSE, FALSE);
     //-----------------------------------------
     // Login handler create account callback
     //-----------------------------------------
     $this->han_login->createAccount(array('member_id' => $member['member_id'], 'email' => $member['email'], 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $this->member->ip_address, 'username' => $member['members_display_name'], 'name' => $member['name'], 'members_display_name' => $member['members_display_name']));
     //-----------------------------------------
     // We'll just ignore if this fails - it shouldn't hold up IPB anyways
     //-----------------------------------------
     /*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
     		{
     			$this->registry->output->showError( 'han_login_create_failed', 2017, true );
     		}*/
     //-----------------------------------------
     // Validation
     //-----------------------------------------
     $validate_key = md5(IPSMember::makePassword() . time());
     $time = time();
     if ($coppa != 1) {
         if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin' or $this->settings['reg_auth_type'] == 'admin_user') {
             //-----------------------------------------
             // We want to validate all reg's via email,
             // after email verificiation has taken place,
             // we restore their previous group and remove the validate_key
             //-----------------------------------------
             $this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address'], 'spam_flag' => $_spamFlag));
             if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin_user') {
                 /* Send out the email. */
                 $message = array('THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global&section=register&do=auto_validate&uid=" . urlencode($member['member_id']) . "&aid=" . urlencode($validate_key), 'publicNoSession', 'false'), 'NAME' => $member['members_display_name'], 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global&section=register&do=05", 'publicNoSession', 'false'), 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key);
                 IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("reg_validate", $this->member->language_id));
                 IPSText::getTextClass('email')->buildPlainTextContent($message);
                 IPSText::getTextClass('email')->buildHtmlContent($message);
                 IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email'], $this->settings['board_name']);
                 IPSText::getTextClass('email')->to = $member['email'];
                 IPSText::getTextClass('email')->sendMail();
                 $this->output = $this->registry->output->getTemplate('register')->showAuthorize($member);
             } else {
                 if ($this->settings['reg_auth_type'] == 'admin') {
                     $this->output = $this->registry->output->getTemplate('register')->showPreview($member);
                 }
             }
             /* Only send new registration email if the member wasn't banned */
             if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
                 $date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
                 IPSText::getTextClass('email')->getTemplate('admin_newuser');
                 IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
                 IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
                 IPSText::getTextClass('email')->to = $this->settings['email_in'];
                 IPSText::getTextClass('email')->sendMail();
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:67,代碼來源:register.php

示例2: convertMember

 /**
  * Convert a member
  *
  * @access	public
  * @param 	array		Basic data (id number, username, email, group, joined date, password)
  * @param 	array 		Data to insert to members table
  * @param 	array 		Data to insert to profile table
  * @param 	array 		Data to insert to custom profile fields table
  * @param 	string 		Path to avatars folder
  * @param 	string 		Path to profile pictures folder
  * @return 	boolean		Success or fail
  **/
 public function convertMember($info, $members, $profile, $custom, $pic_path = '', $groupLink = TRUE)
 {
     //-----------------------------------------
     // Make sure we have everything we need
     //-----------------------------------------
     if (!$info['id']) {
         $this->logError($info['id'], 'No ID number provided');
         return false;
     }
     if (!$info['username']) {
         $this->logError($info['id'], 'No username provided');
         return false;
     }
     if (!$info['email']) {
         // See Tracker Report #28874 for reasons why this got changed.
         $info['email'] = $info['id'] . '@' . time() . '.com';
         //$info['email'] = rand(1, 100).'@'.time().'.com';
         $this->logError($info['id'], 'No email address provided - member converted with ' . $info['email']);
     }
     // Check profile photo
     if (!is_writeable($this->settings['upload_dir'] . '/profile')) {
         $this->error($this->settings['upload_dir'] . '/profile is not writeable, cannot continue');
         return false;
     }
     //-----------------------------------------
     // Set some needed variables
     //-----------------------------------------
     $now = time();
     $joined = $info['joined'] ? $info['joined'] : $now;
     if ($info['md5pass']) {
         $salt = IPSMember::generatePasswordSalt(5);
         $hash = IPSMember::generateCompiledPasshash($salt, $info['md5pass']);
     } elseif ($info['plainpass']) {
         $salt = IPSMember::generatePasswordSalt(5);
         $hash = IPSMember::generateCompiledPasshash($salt, md5($info['plainpass']));
     } elseif ($info['pass_hash']) {
         $salt = $info['pass_salt'];
         $hash = $info['pass_hash'];
     } elseif ($info['password'] !== NULL) {
         $members['conv_password'] = $info['password'];
     } else {
         // give em a random pass, let's stop those posts by these users being lost and assigned to guests.
         $randPass = IPSMember::makePassword();
         $salt = IPSMember::generatePasswordSalt(5);
         $hash = IPSMember::generateCompiledPasshash($salt, $randPass);
         $this->logError($info['id'], 'No password provided. Member has still been converted with password: ' . $randPass);
         //return false;
     }
     $duplicateMember = IPSMember::load($info['email'], 'all');
     if ($duplicateMember['member_id']) {
         $this->logError($info['id'], "Duplicate member found. {$info['username']} has been merged with the account email {$duplicateMember['username']}");
         $this->addLink($duplicateMember['member_id'], $info['id'], 'members');
         $this->DB->update('conv_link', array('duplicate' => '1'), "type = 'members' AND app={$this->app['app_id']} AND foreign_id='{$info['id']}'");
         if ($info['posts'] > 0) {
             $this->DB->update('members', array('posts' => "posts+'{$info['posts']}'"), "member_id='{$duplicateMember['member_id']}'");
         }
         // we have a customavatar and the one we have on file does not match what we've been given, time to update it.
         if ($profile['photo_type'] == 'custom' and $duplicateMember['pp_main_photo'] != $profile['pp_main_photo']) {
             if ($profile['photo_data']) {
                 // open file for writing
                 if (!($handle = fopen($this->settings['upload_dir'] . '/profile/photo-' . $profile['pp_member_id'] . '.png', 'w'))) {
                     $this->logError($info['id'], 'Could not write to file.');
                 }
                 // Write image to our opened file.
                 if (fwrite($handle, $profile['photo_data']) === FALSE) {
                     $this->logError($info['id'], 'Could not write to file.');
                 }
                 // log it all into DB
                 $profile['pp_main_photo'] = 'profile/photo-' . $profile['pp_member_id'] . '.png';
             }
         }
         return TRUE;
     }
     //-----------------------------------------
     // Handle Names
     //-----------------------------------------
     // Apostrophe is an allowed character but needs converting
     $info['username'] = str_replace("'", ''', $info['username']);
     $info['username'] = str_replace("!", '!', $info['username']);
     // as is an excalamation point.
     $nameCheck = IPSMember::getFunction()->cleanAndCheckName($info['username'], array(), 'name');
     // Check for illegal characters
     if ($nameCheck['errors']['username'] == ipsRegistry::getClass('class_localization')->words['reg_error_chars']) {
         // Illegal characters exist, clean them out with dashes
         $nameCheckMap['disallowed'] = array("'", "\"", "&#34;", "<", ">", "\\", "&#92;", "\$", "&#036;", "]", "[", ",", "|");
         $nameCheckMap['replace'] = array('&#39;', '&#quot;', '&#quot;', '&#lt;', '&#gt;', '-', '-', '-', '-', '-', '-', '-', '-');
         $nameCheck['members_display_name'] = str_replace($nameCheckMap['disallowed'], $nameCheckMap['replace'], $nameCheck['username']);
         $this->logError($info['id'], "{$nameCheck['errors']['username']} with name {$info['username']}. Member has still been created but with username as {$nameCheck['username']}");
//.........這裏部分代碼省略.........
開發者ID:mover5,項目名稱:imobackup,代碼行數:101,代碼來源:lib_master.php

示例3: lostPasswordEnd

 /**
  * Completes the lost password request form
  *
  * @return	@e void
  */
 public function lostPasswordEnd()
 {
     if ($this->settings['bot_antispam_type'] != 'none') {
         if (!$this->registry->getClass('class_captcha')->validate($this->request['regid'], $this->request['reg_code'])) {
             $this->lostPasswordForm('err_reg_code');
             return;
         }
     }
     /* Back to the usual programming! :o */
     if ($this->request['member_name'] == "" and $this->request['email_addy'] == "") {
         $this->registry->output->showError('lostpass_name_email', 10110);
     }
     /* Check for input and it's in a valid format. */
     $member_name = trim(strtolower($this->request['member_name']));
     $email_addy = trim(strtolower($this->request['email_addy']));
     if ($member_name == "" and $email_addy == "") {
         $this->registry->output->showError('lostpass_name_email', 10111);
     }
     /* Attempt to get the user details from the DB */
     if ($member_name) {
         $this->DB->build(array('select' => 'members_display_name, name, member_id, email, member_group_id', 'from' => 'members', 'where' => "members_l_username='{$member_name}'"));
         $this->DB->execute();
     } else {
         if ($email_addy) {
             $this->DB->build(array('select' => 'members_display_name, name, member_id, email, member_group_id', 'from' => 'members', 'where' => "email='{$email_addy}'"));
             $this->DB->execute();
         }
     }
     if (!$this->DB->getTotalRows()) {
         $this->registry->output->showError('lostpass_no_user', 10112);
     } else {
         $member = $this->DB->fetch();
         /* Is there a validation key? If so, we'd better not touch it */
         if ($member['member_id'] == "") {
             $this->registry->output->showError('lostpass_no_mid', 2014);
         }
         $validate_key = md5(IPSMember::makePassword() . uniqid(mt_rand(), TRUE));
         /* Get rid of old entries for this member */
         $this->DB->delete('validating', "member_id={$member['member_id']} AND lost_pass=1");
         /* Update the DB for this member. */
         $db_str = array('vid' => $validate_key, 'member_id' => $member['member_id'], 'temp_group' => $member['member_group_id'], 'entry_date' => time(), 'coppa_user' => 0, 'lost_pass' => 1, 'ip_address' => $this->member->ip_address);
         /* Are they already in the validating group? */
         if ($member['member_group_id'] != $this->settings['auth_group']) {
             $db_str['real_group'] = $member['member_group_id'];
         }
         $this->DB->insert('validating', $db_str);
         /* Send out the email. */
         $message = array('USERNAME' => $member['name'], 'NAME' => $member['members_display_name'], 'THE_LINK' => $this->registry->getClass('output')->buildUrl("app=core&module=global&section=lostpass&do=sendform&uid={$member['member_id']}&aid={$validate_key}", 'publicNoSession'), 'MAN_LINK' => $this->registry->getClass('output')->buildUrl('app=core&module=global&section=lostpass&do=sendform', 'publicNoSession'), 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key, 'IP_ADDRESS' => $this->member->ip_address);
         IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("lost_pass", $member['language']));
         IPSText::getTextClass('email')->buildPlainTextContent($message);
         IPSText::getTextClass('email')->buildHtmlContent($message);
         IPSText::getTextClass('email')->subject = $this->lang->words['lp_subject'] . ' ' . $this->settings['board_name'];
         IPSText::getTextClass('email')->to = $member['email'];
         IPSText::getTextClass('email')->sendMail();
         $this->output = $this->registry->getClass('output')->getTemplate('register')->lostPasswordWait($member);
     }
     $this->registry->output->setTitle($this->lang->words['lost_pass_form'] . ' - ' . ipsRegistry::$settings['board_name']);
 }
開發者ID:mover5,項目名稱:imobackup,代碼行數:63,代碼來源:lostpass.php

示例4: saveFormEmailPassword


//.........這裏部分代碼省略.........
         //-----------------------------------------
         // Is this email addy taken?
         //-----------------------------------------
         if (IPSMember::checkByEmail($_emailOne) == TRUE) {
             return array(0 => $this->lang->words['email_is_taken']);
         }
         //-----------------------------------------
         // Load ban filters
         //-----------------------------------------
         $banfilters = array();
         $this->DB->build(array('select' => '*', 'from' => 'banfilters'));
         $this->DB->execute();
         while ($r = $this->DB->fetch()) {
             $banfilters[$r['ban_type']][] = $r['ban_content'];
         }
         //-----------------------------------------
         // Check in banned list
         //-----------------------------------------
         if (isset($banfilters['email']) and is_array($banfilters['email']) and count($banfilters['email'])) {
             foreach ($banfilters['email'] as $email) {
                 $email = str_replace('\\*', '.*', preg_quote($email, "/"));
                 if (preg_match("/^{$email}\$/i", $_emailOne)) {
                     return array(0 => $this->lang->words['email_is_taken']);
                 }
             }
         }
         //-----------------------------------------
         // Load handler...
         //-----------------------------------------
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
         $this->han_login = new $classToLoad($this->registry);
         $this->han_login->init();
         if ($this->han_login->emailExistsCheck($_emailOne) !== FALSE) {
             return array(0 => $this->lang->words['email_is_taken']);
         }
         $this->han_login->changeEmail($this->memberData['email'], $_emailOne, $this->memberData);
         if ($this->han_login->return_code and $this->han_login->return_code != 'METHOD_NOT_DEFINED' and $this->han_login->return_code != 'SUCCESS') {
             return array(0 => $this->lang->words['email_is_taken']);
         }
         //-----------------------------------------
         // Want a new validation? NON ADMINS ONLY
         //-----------------------------------------
         if ($this->settings['reg_auth_type'] and !$this->memberData['g_access_cp']) {
             //-----------------------------------------
             // Remove any existing entries
             //-----------------------------------------
             $_previous = $this->DB->buildAndFetch(array('select' => 'prev_email, real_group', 'from' => 'validating', 'where' => "member_id={$this->memberData['member_id']} AND email_chg=1"));
             if ($_previous['prev_email']) {
                 $this->DB->delete('validating', "member_id={$this->memberData['member_id']} AND email_chg=1");
                 $this->memberData['email'] = $_previous['prev_email'];
                 $this->memberData['member_group_id'] = $_previous['real_group'];
             }
             $validate_key = md5(IPSMember::makePassword() . time());
             //-----------------------------------------
             // Update the new email, but enter a validation key
             // and put the member in "awaiting authorisation"
             // and send an email..
             //-----------------------------------------
             $db_str = array('vid' => $validate_key, 'member_id' => $this->memberData['member_id'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => time(), 'coppa_user' => 0, 'email_chg' => 1, 'ip_address' => $this->member->ip_address, 'prev_email' => $this->memberData['email']);
             if ($this->memberData['member_group_id'] != $this->settings['auth_group']) {
                 $db_str['real_group'] = $this->memberData['member_group_id'];
             }
             $this->DB->insert('validating', $db_str);
             IPSLib::runMemberSync('onEmailChange', $this->memberData['member_id'], strtolower($_emailOne), $this->memberData['email']);
             IPSMember::save($this->memberData['member_id'], array('core' => array('member_group_id' => $this->settings['auth_group'], 'email' => $_emailOne)));
             //-----------------------------------------
             // Update their session with the new member group
             //-----------------------------------------
             if ($this->member->session_id) {
                 $this->member->sessionClass()->convertMemberToGuest();
             }
             //-----------------------------------------
             // Kill the cookies to stop auto log in
             //-----------------------------------------
             IPSCookie::set('pass_hash', '-1', 0);
             IPSCookie::set('member_id', '-1', 0);
             IPSCookie::set('session_id', '-1', 0);
             //-----------------------------------------
             // Dispatch the mail, and return to the activate form.
             //-----------------------------------------
             IPSText::getTextClass('email')->getTemplate("newemail");
             IPSText::getTextClass('email')->buildMessage(array('NAME' => $this->memberData['members_display_name'], 'THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global&section=register&do=auto_validate&type=newemail&uid=" . $this->memberData['member_id'] . "&aid=" . $validate_key, 'publicNoSession', 'false'), 'ID' => $this->memberData['member_id'], 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global&section=register&do=07", 'publicNoSession', 'false'), 'CODE' => $validate_key));
             IPSText::getTextClass('email')->subject = $this->lang->words['lp_subject'] . ' ' . $this->settings['board_name'];
             IPSText::getTextClass('email')->to = $_emailOne;
             IPSText::getTextClass('email')->sendMail();
             $this->registry->getClass('output')->silentRedirect($this->settings['base_url'] . 'app=core&amp;module=global&amp;section=register&amp;do=07');
         } else {
             //-----------------------------------------
             // No authorisation needed, change email addy and return
             //-----------------------------------------
             IPSLib::runMemberSync('onEmailChange', $this->memberData['member_id'], strtolower($_emailOne), $this->memberData['email']);
             IPSMember::save($this->memberData['member_id'], array('core' => array('email' => $_emailOne)));
             //-----------------------------------------
             // Add to OK message
             //-----------------------------------------
             $this->ok_message = $this->lang->words['ok_email_changed'];
         }
     }
     return TRUE;
 }
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:101,代碼來源:usercpForms.php


注:本文中的IPSMember::makePassword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。