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


PHP Site::RemoteIP方法代碼示例

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


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

示例1: contact

 public function contact()
 {
     $content = Content::find_by_permalink("contact");
     $this->assign("content", $content);
     $contact = new Contact();
     if ($this->post) {
         $contact->name = $_POST['name'];
         $contact->emailaddress = $_POST['emailaddress'];
         $contact->subject = $_POST['subject'];
         $contact->message = $_POST['message'];
         $contact->ip = Site::RemoteIP();
         if ($this->csrf) {
             $sent = $contact->send();
             if ($sent) {
                 Site::flash("notice", "The email has been sent");
                 Redirect("contact");
             }
         } else {
             global $site;
             $site['flash']['error'] = "Invalid form submission";
         }
     }
     $this->assign("contact", $contact);
     $this->title = "Contact Us";
     $this->render("contact/contact.tpl");
 }
開發者ID:ItsHaden,項目名稱:epicLanBootstrap,代碼行數:26,代碼來源:contact.controller.php

示例2: login

 /**
  * Takes an RPCUser username and password and, if valid, returns a new RPC Session
  * to be used in further communications.
  * 
  * @arg string Username to log in as
  * @arg string Password to for this username
  * 
  * @param object $method The name of the RPC method
  * @param object $args An array of arguements, listed above
  * @return string The session code
  * @throws RPCException
  */
 public function login($method, $args)
 {
     if (count($args) < 2) {
         throw new RPCException('Invalid arguements', 500);
     }
     $struct = RPCUser::login($args[0], $args[1]);
     if ($struct['code'] == 200) {
         try {
             $session = $struct['user']->createSession(Site::RemoteIP());
             return $session->code;
         } catch (Error500 $e) {
             throw new RPCException($e->getMessage(), 500);
         }
     } else {
         throw new RPCException($struct['error'], $struct['code']);
     }
 }
開發者ID:ItsHaden,項目名稱:epicLanBootstrap,代碼行數:29,代碼來源:rpc.controller.php

示例3: GenerateCSRFHash

 protected static function GenerateCSRFHash()
 {
     $hash = md5(rand(1, 9999999) . microtime(true) + Site::RemoteIP());
     $hash = base_convert($hash, 16, 36);
     $_SESSION['csrf'] = $hash;
     return $hash;
 }
開發者ID:ItsHaden,項目名稱:epicLanBootstrap,代碼行數:7,代碼來源:controller.php

示例4: intranet_index

 public function intranet_index($permalink = null)
 {
     global $config;
     if (!in_array(Site::RemoteIP(), $config['intranet']['ips'])) {
         //throw new Error403();
     }
     $event = self::load_event($permalink, true);
     if ($_GET['key'] == md5("winbarmint")) {
         $event_id = mysql_real_escape_string($event->id);
         $signups = EventSignup::find_all("event_signups.event_id = '{$event_id}' AND event_signups.paid = true AND event_signups.voucher = false", "users.id ASC");
         $this->assign("signups", $signups);
         $this->assign("event", $event);
         header('Content-Type: text/xml');
         $this->render("event_signup/intranet_index.tpl", true);
     } else {
         Error403();
     }
 }
開發者ID:ItsHaden,項目名稱:epicLanBootstrap,代碼行數:18,代碼來源:event_signup.controller.php

示例5: signup

 public function signup()
 {
     global $config;
     global $site;
     $user = new User();
     $user->requiresContactData = true;
     $arid = '';
     if (isset($_SESSION['affiliate_referral'])) {
         $arid = $_SESSION['affiliate_referral'];
     }
     $user->referral_type = "none";
     if ($this->post) {
         $user->nickname = $this->PostData('nickname');
         $user->email = $this->PostData('email');
         $user->password = $this->PostData('password');
         $user->password_confirmation = $this->PostData('password_confirmation');
         $user->firstname = $this->PostData('firstname');
         $user->surname = $this->PostData('surname');
         $user->clan = $this->PostData('clan');
         $user->address1 = $this->PostData('address1');
         $user->address2 = $this->PostData('address2');
         $user->towncity = $this->PostData('towncity');
         $user->county = $this->PostData('county');
         $user->country_id = $this->PostData('country_id');
         $user->postcode = $this->PostData('postcode');
         $user->phone = $this->PostData('phone');
         $user->set_dateofbirth($this->PostData('dateofbirth'));
         $user->terms = $this->PostData('terms');
         $user->allow_emails = $this->PostData('allow_emails');
         $user->referral_type = $this->PostData('referral_type');
         $arid = $this->PostData('arid');
         $valid = $user->validate();
         $validCaptcha = Recaptcha::validate($this->PostData('g-recaptcha-response'), Site::RemoteIP());
         if (!$validCaptcha) {
             $this->assign("failedcaptcha", true);
         } elseif ($valid) {
             $user->save();
             // This was a referral, make a note.
             if ($arid) {
                 AffiliateReferral::create_from_arid($user, $arid);
             }
             Email::send_user_signup($user);
             Redirect("signup/complete");
         }
     }
     $this->assign("affiliate_referral_id", $arid);
     $referral_types = array_merge(array("none" => "Please choose..."), $user->referral_types);
     $this->assign("referral_types", $referral_types);
     $terms = Content::find_by_permalink("signup-terms");
     $countries = Utils::FormOptions(Country::find_all("", "countries.name ASC"));
     $this->assign('countries', $countries);
     $this->assign("user", $user);
     $this->assign("site", $site);
     $this->assign("terms", $terms);
     $this->assign('arid', $arid);
     global $config;
     $this->assign('recaptcha', $config['recaptcha']['public']);
     $this->title = "Signup";
     $this->render("user/signup.tpl");
 }
開發者ID:ItsHaden,項目名稱:epicLanBootstrap,代碼行數:60,代碼來源:user.controller.php


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