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


PHP input::ipaddress方法代码示例

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


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

示例1: _sendFeedback

 protected function _sendFeedback()
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     // Extra rules
     $rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000)));
     if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
         $rules['captcha'] = array('rules' => array('is_captcha'));
     }
     validate::setRules($rules);
     // Validate form values
     if (!validate::run($rules)) {
         return false;
     }
     // Get values
     $email = input::post('email');
     $subject = input::post('subject');
     $message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress();
     // Send feedback
     if (!$this->feedback_model->sendFeedback($email, $subject, $message)) {
         if (!validate::getTotalErrors()) {
             view::setError(__('send_error', 'system'));
         }
         return false;
     }
     // Success
     view::setInfo(__('message_sent', 'feedback'));
     router::redirect('feedback');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:31,代码来源:feedback.php

示例2: isRecentSignup

 public function isRecentSignup()
 {
     $user = $this->db->query("SELECT COUNT(*) AS `totalrows` FROM `:prefix:users` WHERE `ip_address`=? AND `join_date`>=? LIMIT 1", array(input::ipaddress(), date_helper::now() - config::item('signup_delay', 'users') * 60))->row();
     return $user['totalrows'] ? true : false;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:5,代码来源:users.php

示例3: deleteSearch

 public function deleteSearch($search_id)
 {
     $retval = $this->db->delete('core_search', array('search_id' => $search_id, session::item('user_id') ? "user_id" : "ip_address" => session::item('user_id') ? session::item('user_id') : input::ipaddress()), 1);
     return $retval;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:5,代码来源:search.php

示例4: 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

示例5: logout

 public function logout()
 {
     if (session::item('spy_id')) {
         $oldID = session::item('user_id');
         $this->login(session::item('spy_id'), 0, array());
         session::delete('spy_id');
         router::redirect('cp/users/edit/' . $oldID);
     }
     $authID = session::item('auth_id');
     $userID = session::item('user_id');
     $ipaddress = substr(input::ipaddress(), 0, 15);
     $useragent = substr(input::useragent(), 0, 255);
     $this->deleteSession($authID, $userID, $ipaddress, $useragent);
     // Action hook
     hook::action('users/account/logout', $userID);
     cookie::delete('sessdata');
     session::set('auth_id', 0);
     session::set('user_id', 0);
     session::delete(array('auth_id', 'user_id'));
     session::destroy();
     session::initialize();
     return true;
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:23,代码来源:session.php

示例6: _saveAccount

 protected function _saveAccount()
 {
     // Create rules
     $rules = array('email' => array('label' => __('email', 'users'), 'rules' => array('trim', 'required', 'max_length' => 255, 'valid_email', 'callback__is_unique_email')));
     // Did we login using a third party site?
     if (!session::item('connection', 'remote_connect')) {
         $rules['password'] = array('label' => __('password', 'users'), 'rules' => array('trim', 'required', 'min_length' => 4, 'max_length' => 128));
         $rules['password2'] = array('label' => __('password_confirm', 'users'), 'rules' => array('trim', 'matches' => 'password'));
     }
     // Do we have usernames?
     if (config::item('user_username', 'users')) {
         $rules['username'] = array('label' => __('username', 'users'), 'rules' => array('trim', 'required', 'min_length' => 3, 'max_length' => 128, 'callback__is_valid_username'));
     }
     // Do we have more than 1 user type?
     if (count(config::item('usertypes', 'core', 'names')) > 1) {
         $rules['type_id'] = array('label' => __('user_type', 'users'), 'rules' => array('required', 'intval', 'callback__is_user_type'));
     }
     // Is captcha enabled?
     if (!session::item('connection', 'remote_connect') && config::item('signup_captcha', 'users')) {
         $rules['captcha'] = array('rules' => array('is_captcha'));
     }
     // Do we require terms of service?
     if (config::item('signup_require_terms', 'users')) {
         $rules['terms'] = array('label' => '', 'rules' => array('callback__is_terms'));
     }
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Is this a recent request?
     if (config::item('signup_delay', 'users') != -1 && ($this->requests_model->isRecentRequest('signup', input::ipaddress(), 0, config::item('signup_delay', 'users')) || $this->users_model->isRecentSignup())) {
         // Success
         view::setError(__('request_recent_signup', 'users_signup'));
         return false;
     }
     // Get post data
     $data = input::post(array('email', 'password'));
     // Do we have usernames?
     if (config::item('user_username', 'users')) {
         $data['username'] = input::post('username');
     }
     // Do we have more than 1 user type?
     if (count(config::item('usertypes', 'core', 'names')) > 1) {
         $data['type_id'] = input::post('type_id');
     } else {
         $data['type_id'] = config::item('type_default_id', 'users');
     }
     // Set user session data
     session::set(array('account' => $data), '', 'signup');
     // Redirect to the next step
     $this->_nextStep();
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:54,代码来源:signup.php


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