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


PHP Am_Request::getClientIp方法代码示例

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


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

示例1: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     $a = new Am_Paysystem_Action_Redirect($this->host());
     $vars = array('TransactionType' => 'SALE', 'ServiceID' => $this->getConfig('ServiceID'), 'PaymentID' => $invoice->public_id, 'OrderNumber' => $invoice->public_id, 'PaymentDesc' => $invoice->getLineDescription(), 'MerchantReturnURL' => $this->getPluginUrl('thanks'), 'Amount' => $invoice->first_total, 'CurrencyCode' => $invoice->currency, 'CustIP' => $request->getClientIp(), 'CustName' => $user->getName(), 'CustEmail' => $user->email, 'CustPhone' => $user->phone, 'MerchantName' => $this->getDi()->config->get('site_title'), 'PageTimeout' => '3600');
     $a->HashValue = hash('sha256', $this->getConfig('password') . $vars['ServiceID'] . $vars['PaymentID'] . $vars['MerchantReturnURL'] . $vars['Amount'] . $vars['CurrencyCode'] . $vars['CustIP'] . $vars['PageTimeout']);
     foreach ($vars as $k => $v) {
         $a->{$k} = $v;
     }
     $result->setAction($a);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:11,代码来源:e-ghl.php

示例2: _checkIp

 /**
  * Compare request IP with configured in plugin
  * and raise exception if that is wrong
  * @param mixed $ip string will be parsed using this format: $ip1_start [- $ip1_end][\n$ip2_start [- $ip2_end]] etc... 
  * Array should have this format: array( array('start1', 'stop1'), single_ip, array('start2', 'stop2'))
  * also it may automatically check for hostname belonging to subdomain like
  * .worldpay.com
  */
 public function _checkIp($ip)
 {
     $got = $this->request->getClientIp(false);
     if (!is_array($ip)) {
         $expected = array();
         foreach (split("\n", $ip) as $l) {
             if (strpos($l, "-") !== false) {
                 list($k, $v) = split("-", $l);
                 $expected[] = array(trim($k), trim($v));
             } else {
                 $expected[] = trim($l);
             }
         }
     } else {
         $expected = $ip;
     }
     $expected = array_filter($expected);
     if (empty($expected)) {
         throw new Am_Exception_InputError("{$this->plugin->getId()} configuration error. Expected IP address array is empty!");
     }
     $found = false;
     $hostname = null;
     foreach ($expected as $v) {
         if (is_array($v)) {
             if (ip2long($got) >= ip2long($v[0]) && ip2long($got) <= ip2long($v[1])) {
                 $found = true;
                 break;
             }
         } else {
             if ($got == $v) {
                 $found = true;
                 break;
             }
             if ($v[0] == '.') {
                 if (!$hostname) {
                     $hostname = gethostbyaddr($got);
                 }
                 if (preg_match($x = '|' . preg_quote($v) . '$|', $hostname)) {
                     $found = true;
                     break;
                 }
             }
         }
     }
     if (!$found) {
         throw new Am_Exception_Paysystem_TransactionSource("{$this->plugin->getId()} post comes from unknown IP [{$got}]");
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:56,代码来源:Incoming.php

示例3: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $xml = new SimpleXMLElement('<request/>');
     $transactiondetails = $xml->addChild('transactiondetails');
     $transactiondetails->addChild('merchantcode', $this->getConfig('merchantid'));
     $transactiondetails->addChild('merchantpwd', $this->getConfig('merchantpwd'));
     $transactiondetails->addChild('trackid', $invoice->public_id);
     $transactiondetails->addChild('customerip', $request->getClientIp());
     $transactiondetails->addChild('udf1', $invoice->public_id);
     $transactiondetails->addChild('customerid', $invoice->getLogin());
     $paymentdetails = $xml->addChild('paymentdetails');
     $paymentdetails->addChild('paysource', 'enets');
     $paymentdetails->addChild('amount', $invoice->first_total);
     $paymentdetails->addChild('currency', $invoice->currency);
     $paymentdetails->addChild('actioncode', 1);
     $notificationurls = $xml->addChild('notificationurls');
     $notificationurls->addChild('successurl', $this->getReturnUrl());
     $notificationurls->addChild('failurl', $this->getCancelUrl());
     $shippingdetails = $xml->addChild('shippingdetails');
     foreach (array('ship_address' => $invoice->getStreet(), 'ship_email' => $invoice->getEmail(), 'ship_postal' => $invoice->getZip(), 'ship_address2' => $invoice->getStreet1(), 'ship_city' => $invoice->getCity(), 'ship_state' => $invoice->getState(), 'ship_phone' => $invoice->getPhone(), 'ship_country' => $invoice->getCountry()) as $k => $v) {
         $shippingdetails->addChild($k, $v);
     }
     $req = new Am_HttpRequest($this->getConfig('gatewayurl'), Am_HttpRequest::METHOD_POST);
     $req->setHeader('Content-type: text/xml; charset=utf-8')->setHeader('Connection:close')->setBody($xml->asXML());
     $response = $req->send();
     $resxml = @simplexml_load_string($response->getBody());
     if (!$resxml instanceof SimpleXMLElement) {
         throw new Am_Exception_InputError('Incorrect Gateway response received!');
     }
     if ($paymenturl = (string) $resxml->transactionresponse->paymenturl) {
         $a = new Am_Paysystem_Action_Redirect($paymenturl);
         $result->setAction($a);
     } else {
         throw new Am_Exception_InputError('Incorrect Gateway response received! Got: ' . (string) $resxml->responsedesc);
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:36,代码来源:checkout-enets.php

示例4: checkExternalLogin

 function checkExternalLogin(Am_Request $request)
 {
     // Check cookies
     if ($this->getDi()->config->get('protect.php_include.remember_login', false) && !is_null($request->getCookie('amember_ru')) && !is_null($request->getCookie('amember_rp'))) {
         $this->setFromCookie(true);
         $authResult = $this->login($request->getCookie('amember_ru'), $request->getCookie('amember_rp'), $request->getClientIp(), false);
         $this->setFromCookie(false);
         if ($authResult->isValid()) {
             return $authResult;
         }
     }
     /// Check plugins login;
     $e = new Am_Event_AuthCheckLoggedIn();
     $this->getDi()->hook->call($e);
     if ($e->isSuccess()) {
         $errorResult = $this->checkUser($e->getUser(), $request->getClientIp());
         if ($errorResult) {
             return;
         }
         $this->setUser($e->getUser(), $request->getClientIp());
         $this->onSuccess();
         return new Am_Auth_Result(Am_Auth_Result::SUCCESS);
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:24,代码来源:User.php

示例5: directAction

 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $actionName = $request->getActionName();
     if ($actionName == 'ipn') {
         if (!in_array($request->getClientIp(), $this->ips)) {
             throw new Am_Exception_InputError("Request not handled - ip is not allowed");
         }
         if ($request->get('art') == 'request') {
             $shopid = $request->get('shopid');
             if (!$shopid) {
                 throw new Am_Exception_InputError("Parameter shopid wasn't received");
             }
             $invoice = Am_Di::getInstance()->invoiceTable->findFirstByPublicId($shopid);
             if (!$invoice) {
                 throw new Am_Exception_InputError("No invoice found");
             }
             $params = array();
             $params['nachname'] = $invoice->getLastName();
             $params['vorname'] = $invoice->getFirstName();
             $params['strasse'] = $invoice->getStreet();
             $params['plz'] = $invoice->getZip();
             $params['ort'] = $invoice->getCity();
             $params['land'] = $invoice->getUser()->country;
             $params['email'] = $invoice->getEmail();
             $params['betrag'] = $invoice->first_total * 100;
             $params['compain_id'] = '';
             $params['ipadresse'] = $invoice->getUser()->remote_addr;
             if ($invoice->second_period) {
                 $aboanlage = 1;
                 $abopreis = $invoice->second_total * 100;
                 preg_match("/[\\d]+/", $invoice->second_period, $days);
                 if ($days[0] <= 365 && $days[0] >= 30) {
                     $abozeit = $days[0];
                 }
                 preg_match("/[\\d]+/", $invoice->first_period, $days);
                 if ($days[0] <= 365 && $days[0] >= 3) {
                     $abonext = $days[0];
                 }
                 $params['aboanlage'] = $aboanlage;
                 $params['abopreis'] = $abopreis;
                 $params['abozeit'] = $abozeit;
                 $params['abonext'] = $abonext;
             }
             $params['cur'] = strtolower($invoice->currency);
             $message = '';
             foreach ($params as $p) {
                 $message .= $p . ";";
             }
             echo utf8_decode($message);
             return;
         }
         //Getting invoice for providing a redirect-URL with the result confirmation
         $shopid = $request->get('shopid');
         $this->invoice = Am_Di::getInstance()->invoiceTable->findFirstByPublicId($shopid);
         $invoiceLog = $this->_logDirectAction($request, $response, $invokeArgs);
         $transaction = $this->createTransaction($request, $response, $invokeArgs);
         if (!$this->invoice) {
             throw new Am_Exception_InputError("Request not handled - Request's parameter shopid is incorrect");
         }
         if (!$transaction) {
             throw new Am_Exception_InputError("Request not handled - createTransaction() returned null");
         }
         $transaction->setInvoiceLog($invoiceLog);
         try {
             $transaction->process();
         } catch (Exception $e) {
             echo "OK;" . $this->getCancelUrl() . "?shopid=" . $this->invoice->public_id;
             if ($invoiceLog) {
                 $invoiceLog->add($e);
             }
             throw $e;
         }
         echo "OK;" . $this->getReturnUrl() . "?shopid=" . $this->invoice->public_id;
         if ($invoiceLog) {
             $invoiceLog->setProcessed();
         }
     } else {
         return parent::directAction($request, $response, $invokeArgs);
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:80,代码来源:inet-cash.php


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