本文整理汇总了PHP中IPSLib::makePassword方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::makePassword方法的具体用法?PHP IPSLib::makePassword怎么用?PHP IPSLib::makePassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::makePassword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerProcessForm
//.........这里部分代码省略.........
/* Flag for admin approval */
/* Flag for admin approval */
case 2:
$member['member_group_id'] = $this->settings['auth_group'];
$this->settings['reg_auth_type'] = 'admin';
break;
/* Approve the account, but ban it */
/* Approve the account, but ban it */
case 3:
$member['member_banned'] = 1;
$member['member_group_id'] = $this->settings['banned_group'];
$this->settings['reg_auth_type'] = '';
break;
}
}
//-----------------------------------------
// Create the account
//-----------------------------------------
$member = IPSMember::create(array('members' => $member, 'pfields_content' => $this->request));
//-----------------------------------------
// Login handler create account callback
//-----------------------------------------
$this->han_login->createAccount(array('email' => $member['email'], 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $this->member->ip_address, 'username' => $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(IPSLib::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']));
if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin_user') {
IPSText::getTextClass('email')->getTemplate("reg_validate");
IPSText::getTextClass('email')->buildMessage(array('THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=auto_validate&uid=" . urlencode($member['member_id']) . "&aid=" . urlencode($validate_key), 'NAME' => $member['members_display_name'], 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=register&do=05", 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key));
IPSText::getTextClass('email')->subject = $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);
}
}
if ($this->settings['new_reg_notify']) {
$date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
IPSText::getTextClass('email')->getTemplate('admin_newuser');
IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'MEMBER_NAME' => $member['members_display_name']));
IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
IPSText::getTextClass('email')->to = $this->settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
$this->registry->output->setTitle($this->lang->words['reg_success']);
$this->registry->output->addNavigation($this->lang->words['nav_reg'], '');
} else {
示例2: saveFormEmail
/**
* UserCP Save Form: Email Address
*
* @access public
* @return mixed Array of errors / boolean true
*/
public function saveFormEmail()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_emailOne = strtolower(trim($this->request['in_email_1']));
$_emailTwo = strtolower(trim($this->request['in_email_2']));
$captchaInput = trim(ipsRegistry::$request['captchaInput']);
$captchaUniqueID = trim(ipsRegistry::$request['captchaUniqueID']);
//-----------------------------------------
// Check input
//-----------------------------------------
if ($this->memberData['g_access_cp']) {
return array(0 => $this->lang->words['admin_emailpassword']);
}
if (!$_POST['in_email_1'] or !$_POST['in_email_2']) {
return array(0 => $this->lang->words['complete_entire_form']);
}
//-----------------------------------------
// Check password...
//-----------------------------------------
if (!$this->_isFBUser) {
if ($this->_checkPassword($this->request['password']) === FALSE) {
return array(0 => $this->lang->words['current_pw_bad']);
}
}
//-----------------------------------------
// Test email addresses
//-----------------------------------------
if ($_emailOne != $_emailTwo) {
return array(0 => $this->lang->words['emails_no_matchy']);
}
if (IPSText::checkEmailAddress($_emailOne) !== TRUE) {
return array(0 => $this->lang->words['email_not_valid']);
}
//-----------------------------------------
// Is this email addy taken?
//-----------------------------------------
if (IPSMember::checkByEmail($_emailOne) == TRUE) {
return array(0 => $this->lang->words['email_is_taken']);
}
//-----------------------------------------
// Load ban filters
//-----------------------------------------
$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']);
}
}
}
//-----------------------------------------
// Anti bot flood...
//-----------------------------------------
if ($this->settings['bot_antispam']) {
if ($this->registry->getClass('class_captcha')->validate() !== TRUE) {
return array(0 => $this->lang->words['captcha_email_invalid']);
}
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
$this->han_login = new han_login($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);
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']);
}
//-----------------------------------------
// Require new validation? NON ADMINS ONLY
//-----------------------------------------
if ($this->settings['reg_auth_type'] and !$this->memberData['g_access_cp']) {
$validate_key = md5(IPSLib::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->request['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'];
//.........这里部分代码省略.........
示例3: create
/**
* Create new member
* Very basic functionality at this point.
*
* @access public
* @param array Fields to save in the following format: array( 'members' => array( 'email' => 'test@test.com',
* 'joined' => time() ),
* 'extendedProfile' => array( 'signature' => 'My signature' ) );
* Tables: members, pfields_content, profile_portal.
* You can also use the aliases: 'core [members]', 'extendedProfile [profile_portal]', and 'customFields [pfields_content]'
* @param bool Flag to attempt to auto create a name if the desired is taken
* @param bool Bypass custom field saving (if using the sso session integration this is required as member object isn't ready yet)
* @return array Final member Data including member_id
*
* EXCEPTION CODES
* CUSTOM_FIELDS_EMPTY - Custom fields were not populated
* CUSTOM_FIELDS_INVALID - Custom fields were invalid
* CUSTOM_FIELDS_TOOBIG - Custom fields too big
*/
public static function create($tables = array(), $autoCreateName = FALSE, $bypassCfields = FALSE)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$finalTables = array();
$password = '';
$bitWiseFields = ipsRegistry::fetchBitWiseOptions('global');
//-----------------------------------------
// Remap tables if required
//-----------------------------------------
foreach ($tables as $table => $data) {
$_name = isset(self::$remap[$table]) ? self::$remap[$table] : $table;
if ($_name == 'members') {
/* Magic password field */
$password = isset($data['password']) ? trim($data['password']) : IPSLib::makePassword();
$md_5_password = md5($password);
unset($data['password']);
}
$finalTables[$_name] = $data;
}
//-----------------------------------------
// Custom profile field stuff
//-----------------------------------------
if (!$bypassCfields) {
require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
$fields = new customProfileFields();
if (is_array($finalTables['pfields_content']) and count($finalTables['pfields_content'])) {
$fields->member_data = $finalTables['pfields_content'];
}
$_cfieldMode = 'normal';
$fields->initData('edit');
$fields->parseToSave($finalTables['pfields_content'], 'register');
/* Check */
if (count($fields->error_fields['empty'])) {
//throw new Exception( 'CUSTOM_FIELDS_EMPTY' );
}
if (count($fields->error_fields['invalid'])) {
//throw new Exception( 'CUSTOM_FIELDS_INVALID' );
}
if (count($fields->error_fields['toobig'])) {
//throw new Exception( 'CUSTOM_FIELDS_TOOBIG' );
}
}
//-----------------------------------------
// Make sure the account doesn't exist
//-----------------------------------------
if ($finalTables['members']['email']) {
$existing = IPSMember::load($finalTables['members']['email'], 'all');
if ($existing['member_id']) {
$existing['full'] = true;
$existing['timenow'] = time();
return $existing;
}
}
//-----------------------------------------
// Fix up usernames and display names
//-----------------------------------------
/* Ensure we have a display name */
$finalTables['members']['members_display_name'] = $finalTables['members']['members_display_name'] ? $finalTables['members']['members_display_name'] : $finalTables['members']['name'];
//-----------------------------------------
// Clean up characters
//-----------------------------------------
if ($finalTables['members']['name']) {
$userName = IPSMember::getFunction()->cleanAndCheckName($finalTables['members']['name'], array(), 'name');
if ($userName['errors']) {
$finalTables['members']['name'] = '';
} else {
$finalTables['members']['name'] = $userName['username'];
}
}
if ($finalTables['members']['members_display_name']) {
$displayName = IPSMember::getFunction()->cleanAndCheckName($finalTables['members']['members_display_name']);
if ($displayName['errors']) {
$finalTables['members']['members_display_name'] = '';
} else {
$finalTables['members']['members_display_name'] = $displayName['members_display_name'];
}
}
//-----------------------------------------
// Remove some basic HTML tags
//.........这里部分代码省略.........
示例4: lostPasswordEnd
/**
* Completes the lost password request form
*
* @access public
* @return void
*/
public function lostPasswordEnd()
{
if ($this->settings['bot_antispam']) {
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(IPSLib::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->request['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. */
IPSText::getTextClass('email')->getTemplate('lost_pass');
IPSText::getTextClass('email')->buildMessage(array('NAME' => $member['members_display_name'], 'THE_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=lostpass&do=sendform&uid=" . $member['member_id'] . "&aid=" . $validate_key, 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global§ion=lostpass&do=sendform", 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key, 'IP_ADDRESS' => $this->member->ip_address));
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']);
}