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


PHP text::rand_str方法代碼示例

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


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

示例1: reset_password

 public function reset_password()
 {
     $this->template->header->this_body = '';
     $this->template->content = new View('mhi/mhi_reset_password');
     $this->template->content->reset_flag = FALSE;
     if ($_POST) {
         // Validate the email address
         $post = Validation::factory($_POST);
         $post->pre_filter('trim');
         $post->add_rules('email', 'required', 'email');
         if ($post->validate()) {
             $settings = kohana::config('settings');
             $mhi_user = new Mhi_User_Model();
             $email = $post->email;
             $mhi_user_id = $mhi_user->get_id($email);
             $new_password = text::rand_str(15);
             $update = $mhi_user->update($mhi_user_id, array('password' => $new_password));
             $to = $email;
             $from = $settings['site_email'];
             $subject = 'Your Crowdmap password has been reset.';
             $message = 'You have chosen to have your password reset. We have gone ahead and changed your login information to the following:' . "\n\n";
             $message .= 'E-mail: ' . $email . "\n";
             $message .= 'Password: ' . $new_password . "\n\n";
             $message .= 'Now that your password has changed, please visit the website at http://crowdmap.com to change it to something you prefer.' . "\n\n";
             $message .= 'Thank you!' . "\n";
             $message .= 'The Crowdmap Team';
             email::send($to, $from, $subject, $message, FALSE);
             Mhi_Log_Model::log($mhi_user_id, 5);
             $this->template->content->reset_flag = TRUE;
         } else {
             throw new Kohana_User_Exception('E-mail Validation Error', "Email didn't validate");
         }
     }
 }
開發者ID:jetherton,項目名稱:Ushahidi_Web,代碼行數:34,代碼來源:mhi.php


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