当前位置: 首页>>代码示例>>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;未经允许,请勿转载。