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


PHP IPSMember::generateCompiledPasshash方法代碼示例

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


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

示例1: createAdminAccount

 /**
  * Create admin account
  *
  * @access	public
  * @return	@e void
  */
 public static function createAdminAccount()
 {
     /* Build Entry */
     $_mke_time = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $salt = IPSMember::generatePasswordSalt(5);
     $passhash = IPSMember::generateCompiledPasshash($salt, md5(IPSSetUp::getSavedData('admin_pass')));
     $_dname = IPSSetUp::getSavedData('admin_user');
     $member = array('name' => $_dname, 'members_l_username' => strtolower($_dname), 'members_display_name' => $_dname, 'members_l_display_name' => strtolower($_dname), 'members_seo_name' => IPSText::makeSeoTitle($_dname), 'member_login_key' => IPSMember::generateAutoLoginKey(), 'member_login_key_expire' => $_mke_time, 'title' => 'Administrator', 'email' => IPSSetUp::getSavedData('admin_email'), 'member_group_id' => 4, 'posts' => 1, 'joined' => time(), 'last_visit' => time(), 'last_activity' => time(), 'ip_address' => my_getenv('REMOTE_ADDR'), 'view_sigs' => 1, 'restrict_post' => 0, 'msg_show_notification' => 1, 'msg_count_total' => 0, 'msg_count_new' => 0, 'coppa_user' => 0, 'language' => IPSLib::getDefaultLanguage(), 'members_auto_dst' => 1, 'member_uploader' => 'flash', 'allow_admin_mails' => 0, 'members_pass_hash' => $passhash, 'members_pass_salt' => $salt, 'has_blog' => '', 'fb_token' => '', 'ignored_users' => '', 'members_cache' => '', 'failed_logins' => '', 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0);
     /* Insert: MEMBERS */
     ipsRegistry::DB()->setDataType(array('name', 'members_display_name', 'members_l_username', 'members_l_display_name'), 'string');
     ipsRegistry::DB()->insert('members', $member);
     $member_id = ipsRegistry::DB()->getInsertId();
     $member['member_id'] = $member_id;
     /* Insert into the custom profile fields DB */
     ipsRegistry::DB()->insert('pfields_content', array('member_id' => $member_id));
     /* Insert into pp */
     ipsRegistry::DB()->insert('profile_portal', array('pp_member_id' => $member_id, 'pp_setting_count_friends' => 1, 'signature' => '', 'pconversation_filters' => '', 'pp_setting_count_comments' => 1, 'pp_setting_count_visitors' => 1));
 }
開發者ID:mover5,項目名稱:imobackup,代碼行數:24,代碼來源:install.php

示例2: create


//.........這裏部分代碼省略.........
                         $_num = $max['max'] + 1;
                         $finalTables['members']['name'] = $finalTables['members']['name'] . '_' . $_num;
                     }
                 } else {
                     $finalTables['members']['name'] = '';
                 }
             }
         } catch (Exception $e) {
         }
     }
     //-----------------------------------------
     // Populate member table(s)
     //-----------------------------------------
     $finalTables['members']['members_l_username'] = isset($finalTables['members']['name']) ? strtolower($finalTables['members']['name']) : '';
     $finalTables['members']['joined'] = $finalTables['members']['joined'] ? $finalTables['members']['joined'] : time();
     $finalTables['members']['email'] = $finalTables['members']['email'] ? $finalTables['members']['email'] : $finalTables['members']['name'] . '@' . $finalTables['members']['joined'];
     $finalTables['members']['member_group_id'] = $finalTables['members']['member_group_id'] ? $finalTables['members']['member_group_id'] : ipsRegistry::$settings['member_group'];
     $finalTables['members']['ip_address'] = $finalTables['members']['ip_address'] ? $finalTables['members']['ip_address'] : ipsRegistry::member()->ip_address;
     $finalTables['members']['members_created_remote'] = intval($finalTables['members']['members_created_remote']);
     $finalTables['members']['member_login_key'] = IPSMember::generateAutoLoginKey();
     $finalTables['members']['member_login_key_expire'] = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $finalTables['members']['view_sigs'] = 1;
     $finalTables['members']['email_pm'] = 1;
     $finalTables['members']['view_img'] = 1;
     $finalTables['members']['view_avs'] = 1;
     $finalTables['members']['restrict_post'] = intval($finalTables['members']['restrict_post']);
     $finalTables['members']['view_pop'] = 1;
     $finalTables['members']['msg_count_total'] = 0;
     $finalTables['members']['msg_count_new'] = 0;
     $finalTables['members']['msg_show_notification'] = 1;
     $finalTables['members']['coppa_user'] = 0;
     $finalTables['members']['auto_track'] = intval($finalTables['members']['auto_track']);
     $finalTables['members']['last_visit'] = $finalTables['members']['last_visit'] ? $finalTables['members']['last_visit'] : time();
     $finalTables['members']['last_activity'] = $finalTables['members']['last_activity'] ? $finalTables['members']['last_activity'] : time();
     $finalTables['members']['language'] = IPSLib::getDefaultLanguage();
     $finalTables['members']['members_editor_choice'] = ipsRegistry::$settings['ips_default_editor'];
     $finalTables['members']['members_pass_salt'] = IPSMember::generatePasswordSalt(5);
     $finalTables['members']['members_pass_hash'] = IPSMember::generateCompiledPasshash($finalTables['members']['members_pass_salt'], $md_5_password);
     $finalTables['members']['members_display_name'] = isset($finalTables['members']['members_display_name']) ? $finalTables['members']['members_display_name'] : '';
     $finalTables['members']['members_l_display_name'] = isset($finalTables['members']['members_display_name']) ? strtolower($finalTables['members']['members_display_name']) : '';
     $finalTables['members']['fb_uid'] = isset($finalTables['members']['fb_uid']) ? $finalTables['members']['fb_uid'] : 0;
     $finalTables['members']['fb_emailhash'] = isset($finalTables['members']['fb_emailhash']) ? strtolower($finalTables['members']['fb_emailhash']) : '';
     $finalTables['members']['members_seo_name'] = IPSText::makeSeoTitle($finalTables['members']['members_display_name']);
     $finalTables['members']['bw_is_spammer'] = intval($finalTables['members']['bw_is_spammer']);
     //-----------------------------------------
     // Insert: MEMBERS
     //-----------------------------------------
     ipsRegistry::DB()->force_data_type = array('name' => 'string', 'members_l_username' => 'string', 'members_display_name' => 'string', 'members_l_display_name' => 'string', 'members_seo_name' => 'string', 'email' => 'string');
     /* Bitwise options */
     if (is_array($bitWiseFields['members'])) {
         $_freeze = array();
         foreach ($bitWiseFields['members'] as $field) {
             if (isset($finalTables['members'][$field])) {
                 /* Add to freezeable array */
                 $_freeze[$field] = $finalTables['members'][$field];
                 /* Remove it from the fields to save to DB */
                 unset($finalTables['members'][$field]);
             }
         }
         if (count($_freeze)) {
             $finalTables['members']['members_bitoptions'] = IPSBWOptions::freeze($_freeze, 'members', 'global');
         }
     }
     ipsRegistry::DB()->insert('members', $finalTables['members']);
     //-----------------------------------------
     // Get the member id
     //-----------------------------------------
     $finalTables['members']['member_id'] = ipsRegistry::DB()->getInsertId();
     //-----------------------------------------
     // Insert: PROFILE PORTAL
     //-----------------------------------------
     $finalTables['profile_portal']['pp_member_id'] = $finalTables['members']['member_id'];
     $finalTables['profile_portal']['pp_setting_count_friends'] = 1;
     $finalTables['profile_portal']['pp_setting_count_comments'] = 1;
     ipsRegistry::DB()->insert('profile_portal', $finalTables['profile_portal']);
     //-----------------------------------------
     // Insert into the custom profile fields DB
     //-----------------------------------------
     if (!$bypassCfields) {
         $fields->out_fields['member_id'] = $finalTables['members']['member_id'];
         ipsRegistry::DB()->delete('pfields_content', 'member_id=' . $finalTables['members']['member_id']);
         ipsRegistry::DB()->insert('pfields_content', $fields->out_fields);
     } else {
         ipsRegistry::DB()->delete('pfields_content', 'member_id=' . $finalTables['members']['member_id']);
         ipsRegistry::DB()->insert('pfields_content', array('member_id' => $finalTables['members']['member_id']));
     }
     //-----------------------------------------
     // Insert into partial ID table
     //-----------------------------------------
     $full_account = false;
     if ($finalTables['members']['members_display_name'] and $finalTables['members']['name'] and $finalTables['members']['email'] != $finalTables['members']['name'] . '@' . $finalTables['members']['joined']) {
         $full_account = true;
     }
     if (!$full_account) {
         ipsRegistry::DB()->insert('members_partial', array('partial_member_id' => $finalTables['members']['member_id'], 'partial_date' => $finalTables['members']['joined'], 'partial_email_ok' => $finalTables['members']['email'] == $finalTables['members']['name'] . '@' . $finalTables['members']['joined'] ? 0 : 1));
     }
     //IPSMember::updateSearchIndex( $finalTables['members']['member_id'] );
     IPSLib::runMemberSync('onCreateAccount', $finalTables['members']);
     return array_merge($finalTables['members'], $finalTables['profile_portal'], !$bypassCfields ? $fields->out_fields : array(), array('timenow' => $finalTables['members']['joined'], 'full' => $full_account));
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:core.php

示例3: 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

示例4: create


//.........這裏部分代碼省略.........
         if ($displayName['errors']) {
             $finalTables['members']['members_display_name'] = '';
         } else {
             $finalTables['members']['members_display_name'] = $displayName['members_display_name'];
         }
     }
     //-----------------------------------------
     // Populate member table(s)
     //-----------------------------------------
     $finalTables['members']['members_l_username'] = isset($finalTables['members']['name']) ? strtolower($finalTables['members']['name']) : '';
     $finalTables['members']['joined'] = $finalTables['members']['joined'] ? $finalTables['members']['joined'] : time();
     $finalTables['members']['email'] = $finalTables['members']['email'] ? $finalTables['members']['email'] : $finalTables['members']['name'] . '@' . $finalTables['members']['joined'];
     $finalTables['members']['member_group_id'] = $finalTables['members']['member_group_id'] ? $finalTables['members']['member_group_id'] : ipsRegistry::$settings['member_group'];
     $finalTables['members']['ip_address'] = $finalTables['members']['ip_address'] ? $finalTables['members']['ip_address'] : ipsRegistry::member()->ip_address;
     $finalTables['members']['members_created_remote'] = intval($finalTables['members']['members_created_remote']);
     $finalTables['members']['member_login_key'] = IPSMember::generateAutoLoginKey();
     $finalTables['members']['member_login_key_expire'] = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $finalTables['members']['view_sigs'] = 1;
     $finalTables['members']['bday_day'] = intval($finalTables['members']['bday_day']);
     $finalTables['members']['bday_month'] = intval($finalTables['members']['bday_month']);
     $finalTables['members']['bday_year'] = intval($finalTables['members']['bday_year']);
     $finalTables['members']['restrict_post'] = intval($finalTables['members']['restrict_post']);
     $finalTables['members']['auto_track'] = $finalTables['members']['auto_track'] ? $finalTables['members']['auto_track'] : ipsRegistry::$settings['auto_track_method'];
     $finalTables['members']['msg_count_total'] = 0;
     $finalTables['members']['msg_count_new'] = 0;
     $finalTables['members']['msg_show_notification'] = 1;
     $finalTables['members']['coppa_user'] = 0;
     $finalTables['members']['auto_track'] = substr($finalTables['members']['auto_track'], 0, 50);
     $finalTables['members']['last_visit'] = $finalTables['members']['last_visit'] ? $finalTables['members']['last_visit'] : time();
     $finalTables['members']['last_activity'] = $finalTables['members']['last_activity'] ? $finalTables['members']['last_activity'] : time();
     $finalTables['members']['language'] = $finalTables['members']['language'] ? $finalTables['members']['language'] : IPSLib::getDefaultLanguage();
     $finalTables['members']['member_uploader'] = ipsRegistry::$settings['uploadFormType'] ? 'flash' : 'default';
     $finalTables['members']['members_pass_salt'] = IPSMember::generatePasswordSalt(5);
     $finalTables['members']['members_pass_hash'] = IPSMember::generateCompiledPasshash($finalTables['members']['members_pass_salt'], $md_5_password);
     $finalTables['members']['members_display_name'] = isset($finalTables['members']['members_display_name']) ? $finalTables['members']['members_display_name'] : '';
     $finalTables['members']['members_l_display_name'] = isset($finalTables['members']['members_display_name']) ? strtolower($finalTables['members']['members_display_name']) : '';
     $finalTables['members']['fb_uid'] = isset($finalTables['members']['fb_uid']) ? $finalTables['members']['fb_uid'] : 0;
     $finalTables['members']['fb_emailhash'] = isset($finalTables['members']['fb_emailhash']) ? strtolower($finalTables['members']['fb_emailhash']) : '';
     $finalTables['members']['members_seo_name'] = IPSText::makeSeoTitle($finalTables['members']['members_display_name']);
     $finalTables['members']['bw_is_spammer'] = intval($finalTables['members']['bw_is_spammer']);
     //-----------------------------------------
     // Insert: MEMBERS
     //-----------------------------------------
     ipsRegistry::DB()->setDataType(array('name', 'members_l_username', 'members_display_name', 'members_l_display_name', 'members_seo_name', 'email'), 'string');
     /* Bitwise options */
     if (is_array($bitWiseFields['members'])) {
         $_freeze = array();
         foreach ($bitWiseFields['members'] as $field) {
             if (isset($finalTables['members'][$field])) {
                 /* Add to freezeable array */
                 $_freeze[$field] = $finalTables['members'][$field];
                 /* Remove it from the fields to save to DB */
                 unset($finalTables['members'][$field]);
             }
         }
         if (count($_freeze)) {
             $finalTables['members']['members_bitoptions'] = IPSBWOptions::freeze($_freeze, 'members', 'global');
         }
     }
     ipsRegistry::DB()->insert('members', $finalTables['members']);
     //-----------------------------------------
     // Get the member id
     //-----------------------------------------
     $finalTables['members']['member_id'] = ipsRegistry::DB()->getInsertId();
     //-----------------------------------------
     // Insert: PROFILE PORTAL
開發者ID:ConnorChristie,項目名稱:GrabViews-Live,代碼行數:67,代碼來源:ipsMember.php


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