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


PHP text_helper::random方法代码示例

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


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

示例1: saveSearch

 public function saveSearch($conditions = array(), $values = array(), $results = 0)
 {
     $data = array('search_id' => text_helper::random(8), 'user_id' => session::item('user_id'), 'conditions' => json_encode($conditions), 'values' => json_encode($values), 'results' => $results, 'post_date' => date_helper::now());
     if (!session::item('user_id')) {
         $data['ip_address'] = input::ipaddress();
     }
     $this->db->insert('core_search', $data);
     return $data['search_id'];
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:9,代码来源:search.php

示例2: saveTransaction

 public function saveTransaction($transactionID, $gatewayID, $invoiceID, $receiptID, $userID, $amount)
 {
     $transaction = array('user_id' => $userID, 'invoice_id' => $invoiceID, 'gateway_id' => $gatewayID, 'receipt_id' => $receiptID ? $receiptID : text_helper::random(10), 'amount' => $amount);
     // Is this a new transaction?
     if (!$transactionID) {
         $transaction['post_date'] = date_helper::now();
         // Save transaction
         $transactionID = $this->db->insert('billing_transactions', $transaction);
         // Action hook
         hook::action('billing/transactions/insert', $transactionID, $transaction);
     } else {
         // Save transaction
         $this->db->update('billing_transactions', $transaction, array('transaction_id' => $transactionID), 1);
         // Action hook
         hook::action('billing/transactions/update', $transactionID, $transaction);
     }
     return $transactionID;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:18,代码来源:transactions.php

示例3: upload

 public function upload($filename, $extensions, $maxsize, $maxdimensions = '')
 {
     if ($maxdimensions && !is_array($maxdimensions)) {
         $maxdimensions = explode('x', $maxdimensions);
     }
     // Upload path
     $suffix = implode('/', str_split(text_helper::random(4, 'numeric')));
     $path = $this->relativePath . '/' . $suffix;
     // Does upload path exist?
     if (!$this->createPath($this->relativePath, $suffix)) {
         return false;
     }
     // Uploader configuration
     $config = array('upload_path' => BASEPATH . $path, 'allowed_types' => str_replace(',', '|', $extensions), 'max_size' => $maxsize * 1024, 'max_width' => isset($maxdimensions[0]) ? $maxdimensions[0] : 0, 'max_height' => isset($maxdimensions[1]) ? $maxdimensions[1] : 0, 'encrypt_name' => true, 'clean_name' => false, 'overwrite' => true);
     // Load uploader library
     loader::library('uploader', $config);
     if (!$this->uploader->run($filename)) {
         $this->setError($this->uploader->getError());
         return false;
     }
     $file = $this->uploader->getData();
     $file['path_suffix'] = $suffix;
     return $file;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:24,代码来源:local.php

示例4: newpass

 public function newpass()
 {
     // Get vars
     $userID = (int) uri::segment(4);
     $hash = uri::segment(5);
     // Validate user ID
     if (!$userID) {
         view::setError(__('user_id_invalid', 'users_signup'));
         router::redirect('users/login');
     }
     // Loader
     loader::library('email');
     loader::model('system/requests');
     // Validate hash
     if (!$hash || !$this->requests_model->validateRequest($hash)) {
         view::setError(__('request_hash_invalid', 'system'));
         router::redirect('users/login');
     }
     // Get user
     if (!($user = $this->users_model->getUser($userID))) {
         view::setError(__('request_hash_invalid', 'system'));
         router::redirect('users/login');
     }
     // Get request
     if (!($request = $this->requests_model->getRequest('lostpass', $hash, $userID))) {
         view::setError(__('request_hash_expired', 'system'));
         router::redirect('users/login');
     }
     // Is user already active?
     if (!$user['verified']) {
         view::setError(__('user_not_verified', 'users_signup'));
         router::redirect('users/login');
     }
     // Generate new password
     $password = text_helper::random(10);
     // Update user's verification status
     $this->users_model->savePassword($userID, $password);
     // Replace tags
     $user['password'] = $password;
     // Send activation email
     $this->email->sendTemplate('users_password_new', $user['email'], $user, $user['language_id']);
     // Remove verification request
     $this->requests_model->deleteRequest('lostpass', $hash, $userID);
     // Success
     view::setInfo(__('request_newpass_sent', 'users_signup'));
     router::redirect('users/login/index/lostpass');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:47,代码来源:login.php

示例5: encryptPassword

 public function encryptPassword($password, $salt = '')
 {
     if ($password == '') {
         return '';
     }
     // Do we have salt?
     if ($salt == '') {
         $salt = text_helper::random(8);
     }
     // Encrypt password
     $password = sha1($password . $salt);
     $password .= $salt;
     return $password;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:14,代码来源:users.php

示例6: saveRequest

 public function saveRequest($keyword, $userID, $itemID = 0, $value = '')
 {
     $data = array('hash' => text_helper::random(16), 'ip_address' => input::ipaddress(), 'post_date' => date_helper::now(), 'keyword' => $keyword, 'user_id' => $userID, 'item_id' => $itemID, 'val' => $value);
     $this->db->insert('core_requests', $data);
     return $data['hash'];
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:6,代码来源:requests.php

示例7: generateSesshash

 public function generateSesshash($ipaddress, $useragent)
 {
     $salt = text_helper::random(8);
     $sesshash = sha1($ipaddress . $useragent . $salt);
     return $sesshash;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:6,代码来源:session.php


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