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


PHP BaseController::randString方法代碼示例

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


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

示例1: createUser

 public static function createUser($user_fp, $input, $timestamp = false)
 {
     $timestamp = $timestamp ? $timestamp : date('Y-m-d H:i:s');
     $pub_hash = BaseController::randString(8) . strtolower(substr($user_fp, -8));
     $priv_hash = BaseController::randString(32);
     $clear_info = BaseController::isSigned(trim($input['info']));
     $user = new User();
     $user->public_hash = $pub_hash;
     $user->private_hash = password_hash($priv_hash, PASSWORD_BCRYPT);
     $user->pgp = trim($input['key']);
     $user->user_fp = $user_fp;
     $user->info = $input['info'] ? $input['info'] : "";
     $user->clear_info = $clear_info ? $clear_info : "";
     $user->active_session = "";
     $user->timestamp = $timestamp;
     $user->save();
     return ['priv_hash' => $priv_hash, 'user' => $user];
 }
開發者ID:libre-net-society,項目名稱:onelon,代碼行數:18,代碼來源:User.php

示例2: createApiKey

 public function createApiKey()
 {
     self::validator(['comment' => 'max:60']);
     $user = User::find(self::userId());
     // Check number of issued keys (max 3)
     if (Apikey::where('user_id', '=', self::userId())->count() > 2) {
         App::abort(500, 'Maximum 3 API keys');
     }
     $key = new Apikey();
     $key->api_key = BaseController::randString(32);
     $key->user_id = self::userId();
     $key->user_fp = self::userFp();
     $key->comment = Input::get('comment', '');
     if (Input::get('readonly')) {
         $key->readonly = 1;
     }
     $key->save();
     return Redirect::to('settings/api_keys');
 }
開發者ID:libre-net-society,項目名稱:onelon,代碼行數:19,代碼來源:SettingsController.php

示例3: session_start

| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function () {
    if (!Request::is('api/*')) {
        session_start();
        if (in_array(BaseController::cookieGet('lang'), ['en', 'ru', 'by'])) {
            App::setLocale(BaseController::cookieGet('lang'));
        }
        if (!BaseController::sessionGet('token')) {
            BaseController::sessionSet('token', BaseController::randString(6));
        }
    }
});
App::after(function () {
});
/*
 *  Registration captcha check
 */
Route::filter('signup', function () {
    if (!BaseController::checkCaptcha()) {
        return View::make('verif.signup');
    }
});
/*
 *  Retrieving URL captcha check
開發者ID:libre-net-society,項目名稱:onelon,代碼行數:31,代碼來源:filters.php


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