当前位置: 首页>>代码示例>>PHP>>正文


PHP Crypt::decrypt方法代码示例

本文整理汇总了PHP中Crypt::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt::decrypt方法的具体用法?PHP Crypt::decrypt怎么用?PHP Crypt::decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crypt的用法示例。


在下文中一共展示了Crypt::decrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDecrypt

 /**
  * Tests Crypt->decrypt()
  */
 public function testDecrypt()
 {
     // Encrypt the data
     $encrypted = $this->crypt->encrypt(self::DATA);
     // Decrypt the data
     $decrypted = $this->crypt->decrypt($encrypted);
     $this->assertTrue($decrypted == self::DATA, 'Testing data decryption');
     unset($encrypted, $decrypted);
 }
开发者ID:spekkionu,项目名称:spekkionu-php-class-collection,代码行数:12,代码来源:CryptTest.php

示例2: loadFromPasswordRecoveryAccessKey

 /**
  * Vlidate access key and find user
  * @param string $accessKey
  * @return CmfDbObject|bool - false = failed to parse access key, validate data or load user
  */
 public static function loadFromPasswordRecoveryAccessKey($accessKey)
 {
     try {
         $data = \Crypt::decrypt($accessKey);
     } catch (DecryptException $exc) {
         return false;
     }
     if (empty($data)) {
         return false;
     }
     $data = json_decode($data, true);
     if (empty($data) || !is_array($data) || empty($data['account_id']) || empty($data['expires_at']) || $data['expires_at'] < time()) {
         return false;
     }
     /** @var CmfDbObject|ResetsPasswordsViaAccessKey $user */
     $user = static::create();
     $conditions = [$user->_getPkFieldName() => $data['account_id']];
     foreach ($user->getAdditionalFieldsForPasswordRecoveryAccessKey() as $fieldName) {
         if (empty($data[$fieldName])) {
             return false;
         }
         $conditions[$fieldName] = $data[$fieldName];
     }
     if (!$user->find($conditions)->exists()) {
         return false;
     }
     return $user;
 }
开发者ID:magicians,项目名称:PeskyCMF,代码行数:33,代码来源:ResetsPasswordsViaAccessKey.php

示例3: getHomeOverview

 public static function getHomeOverview()
 {
     $db = Auth::user()->targets()->where('closed', '=', 0)->orderBy('duedate', 'DESC')->get();
     $ids = array();
     $data = array();
     foreach ($db as $t) {
         $ids[] = intval($t->id);
         $tr = array('id' => $t->id, 'description' => Crypt::decrypt($t->description), 'amount' => floatval($t->amount), 'duedate' => $t->duedate != '0000-00-00' ? new DateTime($t->duedate) : null, 'startdate' => $t->startdate != '0000-00-00' ? new DateTime($t->startdate) : null, 'account' => intval($t->account_id), 'saved' => 0);
         $tr['pct'] = round($tr['saved'] / $tr['amount'] * 100, 2);
         $data[intval($t->id)] = $tr;
     }
     if (count($ids) > 0) {
         $transfers = Auth::user()->transfers()->whereIn('target_id', $ids)->where('date', '<=', Session::get('period')->format('Y-m-d'))->get();
         foreach ($transfers as $t) {
             if ($t->account_from == $data[$t->target_id]['account']) {
                 $data[intval($t->target_id)]['saved'] -= floatval($t->amount);
             } else {
                 if ($t->account_to == $data[$t->target_id]['account']) {
                     $data[intval($t->target_id)]['saved'] += floatval($t->amount);
                 }
             }
         }
     }
     return $data;
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:25,代码来源:Target.php

示例4: showAll

 public function showAll()
 {
     $key = cacheKey('Beneficiaries', 'showAll');
     if (Cache::has($key)) {
         $data = Cache::get($key);
     } else {
         $data = array();
         $beneficiaries = Auth::user()->beneficiaries()->orderBy('id', 'ASC')->get();
         // to get the avg per month we first need the number of months
         foreach ($beneficiaries as $ben) {
             $name = Crypt::decrypt($ben->name);
             $bene = array('id' => intval($ben->id), 'name' => $name);
             $now = new Carbon('now');
             $thisMonth = $ben->transactions()->where(DB::Raw('DATE_FORMAT(`date`,"%m-%Y")'), '=', $now->format('m-Y'))->sum('amount');
             $bene['month'] = floatval($thisMonth);
             $data[] = $bene;
         }
         unset($name);
         $name = array();
         // order by alfabet
         // Obtain a list of columns
         foreach ($data as $key => $row) {
             $id[$key] = $row['id'];
             $name[$key] = $row['name'];
         }
         array_multisort($name, SORT_ASC, $id, SORT_DESC, $data);
         Cache::put($key, $data, 1440);
     }
     return View::make('beneficiaries.all')->with('beneficiaries', $data);
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:30,代码来源:BeneficiaryController.php

示例5: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     switch ($this->method()) {
         // Create
         case 'POST':
             // rules
             $rules['first_name'] = "required";
             $rules['last_name'] = "required";
             $rules['phone'] = "required|unique:users,phone";
             $rules['slug_name'] = "required|unique:users,slug";
             $rules['email'] = "required|email";
             $rules['password'] = "required|alpha_dash|confirmed|min:6";
             $rules['group'] = "required";
             return $rules;
             break;
             // Update
         // Update
         case 'PUT':
             // rules
             $rules['first_name'] = "required";
             $rules['last_name'] = "required";
             $rules['phone'] = "required|unique:users,phone," . \Crypt::decrypt($this->get('id'));
             $rules['slug_name'] = 'required|unique:users,slug,' . \Crypt::decrypt($this->get('id'));
             $rules['email'] = "required|email";
             if ($this->has('password')) {
                 $rules['password'] = "required|alpha_dash|confirmed|min:6";
             }
             $rules['group'] = "required";
             return $rules;
             break;
     }
 }
开发者ID:pinnaclesoftware,项目名称:Work-Tracking-System,代码行数:37,代码来源:UserRequest.php

示例6: login

 public function login(Request $request)
 {
     //        dd(\Crypt::encrypt('jtmccombs@gmail.com'));
     try {
         $email = \Crypt::decrypt($request->get('token'));
     } catch (\Exception $e) {
         return abort('403', 'Forbidden');
     }
     $user = User::whereEmail($email)->first();
     if (!$user) {
         return abort('403', 'Forbidden');
     }
     if (!$user->account) {
         $b2bCompany = \DB::connection('mysql-b2b')->table('companies')->where('user_id', '=', $user->id)->first();
         //            $b2bCompany = false;
         $accountName = $b2bCompany ? $b2bCompany->company_name : $user->email;
         $account = new Account();
         $account->ip = $request->getClientIp();
         $account->name = $accountName;
         $account->account_key = str_random(RANDOM_KEY_LENGTH);
         $account->save();
         $user->account_id = $account->id;
         $user->registered = true;
         $user->save();
         $exists = \DB::connection('mysql')->table('users')->whereId($user->id)->count();
         if (!$exists) {
             \DB::connection('mysql')->table('users')->insert(['id' => $user->id, 'account_id' => $user->account_id, 'created_at' => $user->created_at, 'updated_at' => $user->updated_at, 'deleted_at' => $user->deleted_at, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'phone' => $user->phone, 'username' => $user->username, 'email' => $user->email, 'password' => $user->password, 'confirmation_code' => $user->confirmation_code, 'registered' => $user->registered, 'confirmed' => $user->confirmed, 'notify_sent' => $user->notify_sent, 'notify_viewed' => $user->notify_viewed, 'notify_paid' => $user->notify_paid, 'public_id' => $user->public_id, 'force_pdfjs' => false, 'remember_token' => $user->remember_token, 'news_feed_id' => $user->news_feed_id, 'notify_approved' => $user->notify_approved, 'failed_logins' => $user->failed_logins, 'dark_mode' => $user->dark_mode, 'referral_code' => $user->referral_code]);
         }
     }
     \Auth::loginUsingId($user->id);
     return redirect('/');
 }
开发者ID:sseshachala,项目名称:invoiceninja,代码行数:32,代码来源:AutoLoginController.php

示例7: getModificar

 public function getModificar($id)
 {
     $usuario = Usuario::find($id);
     $roles = Rol::all();
     $contrasenia = Crypt::decrypt($usuario->contrasenia);
     return View::make("usuarios.modificar")->with("usuario", $usuario)->with("roles", $roles)->with("contrasenia", $contrasenia);
 }
开发者ID:omarmurcia,项目名称:AHJNProject,代码行数:7,代码来源:UsuariosController.php

示例8: showAll

 public function showAll()
 {
     $key = cacheKey('Budgets', 'showAll');
     if (Cache::has($key)) {
         $data = Cache::get($key);
     } else {
         $data = array();
         $budgets = Auth::user()->budgets()->orderBy('date', 'DESC')->get();
         foreach ($budgets as $b) {
             $month = new Carbon($b->date);
             $strMonth = $month->format('F Y');
             $data[$strMonth] = isset($data[$strMonth]) ? $data[$strMonth] : array();
             $budget = array('name' => Crypt::decrypt($b->name), 'amount' => floatval($b->amount), 'spent' => $b->spent(), 'overspent' => false, 'id' => intval($b->id), 'left' => 0);
             if ($budget['amount'] != 0) {
                 $pct = $budget['spent'] / $budget['amount'] * 100;
                 $budget['left'] = $budget['amount'] - $budget['spent'];
                 if ($pct > 100) {
                     $budget['overspent'] = true;
                     $budget['pct'] = round($budget['amount'] / $budget['spent'] * 100, 0);
                 } else {
                     $budget['pct'] = round($pct);
                 }
             }
             $data[$strMonth][] = $budget;
         }
     }
     return View::make('budgets.all')->with('budgets', $data);
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:28,代码来源:BudgetController.php

示例9: ldap

 /**
  * Authenticates a user to LDAP
  *
  * @param $username
  * @param $password
  * @param bool|false $returnUser
  * @return bool true    if the username and/or password provided are valid
  *              false   if the username and/or password provided are invalid
  *         array of ldap_attributes if $returnUser is true
  */
 function ldap($username, $password, $returnUser = false)
 {
     $ldaphost = Setting::getSettings()->ldap_server;
     $ldaprdn = Setting::getSettings()->ldap_uname;
     $ldappass = Crypt::decrypt(Setting::getSettings()->ldap_pword);
     $baseDn = Setting::getSettings()->ldap_basedn;
     $filterQuery = Setting::getSettings()->ldap_auth_filter_query . $username;
     $ldapversion = Setting::getSettings()->ldap_version;
     // Connecting to LDAP
     $connection = ldap_connect($ldaphost) or die("Could not connect to {$ldaphost}");
     // Needed for AD
     ldap_set_option($connection, LDAP_OPT_REFERRALS, 0);
     ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, $ldapversion);
     try {
         if ($connection) {
             // binding to ldap server
             $ldapbind = ldap_bind($connection, $ldaprdn, $ldappass);
             if (($results = @ldap_search($connection, $baseDn, $filterQuery)) != false) {
                 $entry = ldap_first_entry($connection, $results);
                 if (($userDn = @ldap_get_dn($connection, $entry)) !== false) {
                     if (($isBound = ldap_bind($connection, $userDn, $password)) == "true") {
                         return $returnUser ? array_change_key_case(ldap_get_attributes($connection, $entry), CASE_LOWER) : true;
                     }
                 }
             }
         }
     } catch (Exception $e) {
         LOG::error($e->getMessage());
     }
     ldap_close($connection);
     return false;
 }
开发者ID:chromahoen,项目名称:snipe-it,代码行数:42,代码来源:AuthController.php

示例10: contacto

 public function contacto()
 {
     $mensaje = null;
     $userpass = User::where('email', '=', Input::get('email'))->first();
     if ($userpass) {
         $pass = Crypt::decrypt($userpass->encry);
         $nombre = $userpass->username;
         if (isset($_POST['contacto'])) {
             $data = array('nombre' => $nombre, 'email' => Input::get('email'), 'pass' => $pass);
             $fromEmail = Input::get('email');
             $fromName = Input::get('nombre');
             Mail::send('emails.contacto', $data, function ($message) use($fromName, $fromEmail) {
                 $message->to($fromEmail, $fromName);
                 $message->from('rugratsmylo@gmail.com', 'administrador');
                 $message->subject('Nuevo Email de contacto');
             });
         }
         return Redirect::to('email')->with('status', 'ok_send');
     } else {
         return Redirect::to('email')->with('status', 'not_send');
     }
     //$data = Input::get('nombre');
     /*foreach ($data as $key => $value) {
     			echo $value.'<br>';
     		}*/
     //echo $data;
     //var_dump($data);
     //return View::make('password.remind')->with('status', 'ok_create');
 }
开发者ID:gabitoooo,项目名称:inventarios,代码行数:29,代码来源:EmailController.php

示例11: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if ($locale = request()->cookie('locale__myProject')) {
         app()->setLocale(\Crypt::decrypt($locale));
     }
     \Carbon\Carbon::setLocale(app()->getLocale());
 }
开发者ID:linuxssm,项目名称:l5essential,代码行数:12,代码来源:AppServiceProvider.php

示例12: run

 public function run()
 {
     $data = $this->_context->get("data", '');
     // Log::Write('【加密数据】Remote Accept:' . $data, Log::DEBUG);
     if ($this->_context->isPOST()) {
         $de_data = Crypt::decrypt($data, App::getConfig('YUC_SECURE_KEY'));
         //  Log::Write('解析的加密数据:' . $de_data, Log::DEBUG);
         $post = json_decode($de_data, TRUE);
         if ($post != '' && is_array($post) && $post['site_key'] == md5(App::getConfig('YUC_SITE_KEY'))) {
             $mod = $post['mod'];
             $act = $post['act'];
             $class = 'Remote_' . $mod;
             if ($act == 'show' && $mod == 'Logs') {
                 $name = $post['name'];
                 $obj = new $class();
                 //self::$_string[' $name']=$name;
                 $ret = $obj->{$act}($name);
             } else {
                 $obj = new $class();
                 $ret = $obj->{$act}();
             }
             Log::Write('Remote Run:' . $mod . ',' . $act . ',' . $ret, Log::DEBUG);
             _returnCryptAjax($ret);
         } else {
             Log::Write('安全认证错误!', Log::DEBUG);
             _returnCryptAjax(array('result' => 0, 'content' => '安全认证比对错误错误!'));
         }
     } else {
         Log::Write('远程控制错误!数据并非POST交互!', Log::DEBUG);
         _returnCryptAjax(array('result' => 0, 'content' => '远程控制错误!数据并非POST交互!'));
     }
 }
开发者ID:saintho,项目名称:phpdisk,代码行数:32,代码来源:execute.php

示例13: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     switch ($this->method()) {
         // Create
         case 'POST':
             // rules
             $rules['group_name'] = "required|unique:groups,name";
             $rules['slug_name'] = "required|unique:groups,slug";
             if (!count($this->permissions)) {
                 //if permission count equal zero
                 $rules['permissions'] = "required";
             }
             return $rules;
             break;
             // Update
         // Update
         case 'PUT':
             // rules
             $rules['group_name'] = 'required|unique:groups,name,' . \Crypt::decrypt($this->get('id'));
             $rules['slug_name'] = 'required|unique:groups,slug,' . \Crypt::decrypt($this->get('id'));
             if (!count($this->permissions)) {
                 //if permission count equal zero
                 $rules['permissions'] = "required";
             }
             return $rules;
             break;
     }
 }
开发者ID:pinnaclesoftware,项目名称:Work-Tracking-System,代码行数:33,代码来源:GroupRequest.php

示例14: get

 /**
  * Get the cookie value
  * 
  * @param string $key
  * @return string or null if cookie value doesn't exist
  */
 public static function get($key)
 {
     if (!isset($_COOKIE[$key])) {
         return null;
     }
     return Crypt::decrypt($_COOKIE[$key], static::getKey());
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:13,代码来源:Cookie.php

示例15: updateBudgetPrediction

 public function updateBudgetPrediction($event)
 {
     $event->name = Crypt::decrypt($event->name);
     // remove all budget prediction points, if any
     $event->budgetpredictionpoints()->delete();
     $similar = array();
     // get all similar budgets from the past:
     $budgets = Auth::user()->budgets()->where('date', '<=', $event->date)->get();
     foreach ($budgets as $budget) {
         $budget->name = Crypt::decrypt($budget->name);
         if ($budget->name == $event->name) {
             $similar[] = $budget->id;
         }
     }
     if (count($similar) > 0) {
         // get all transactions for these budgets:
         $amounts = array();
         $transactions = Auth::user()->transactions()->orderBy('date', 'DESC')->where('onetime', '=', 0)->whereIn('budget_id', $similar)->get();
         foreach ($transactions as $t) {
             $date = new Carbon($t->date);
             $day = intval($date->format('d'));
             $amounts[$day] = isset($amounts[$day]) ? $amounts[$day] + floatval($t->amount) * -1 : floatval($t->amount) * -1;
         }
         // then make sure it's "average".
         foreach ($amounts as $day => $amount) {
             // save as budget prediction point.
             $bpp = new Budgetpredictionpoint();
             $bpp->budget_id = $event->id;
             $bpp->amount = $amount / count($similar);
             $bpp->day = $day;
             $bpp->save();
         }
     }
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:34,代码来源:BudgetEventHandler.php


注:本文中的Crypt::decrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。