getRemoteIp() public static method

public static getRemoteIp ( )
示例#1
0
 public function insert()
 {
     $password = $this->get(Gpf_Db_Table_AuthUsers::PASSWORD);
     if (strlen(trim($password)) == 0) {
         $this->set(Gpf_Db_Table_AuthUsers::PASSWORD, Gpf_Common_String::generatePassword(8));
     }
     $this->generateAuthToken();
     $this->setIp(Gpf_Http::getRemoteIp());
     parent::insert();
 }
示例#2
0
    public static function generateNewVisitorId() {
        $stamp = microtime();
        $ip = Gpf_Http::getRemoteIp();
        $id = md5($stamp*$ip + rand()) . crypt($ip + $stamp * rand(), CRYPT_BLOWFISH);

        $id = str_replace("$", "0", $id);
        $id = str_replace("/", "0", $id);
        $id = str_replace(".", "0", $id);
        $uniqueid = substr($id, rand(0, 13), Pap_Tracking_Visit_Processor::getVisitorIdLength());
        return $uniqueid;
    }
示例#3
0
 protected function setVariableValues() {
     $this->setVariable(self::AFF_NAME, trim($this->user->getFirstName()) . ' ' . trim($this->user->getLastName()));
     $this->setVariable(self::AFF_REFID, trim($this->user->getRefId()));
     $this->setVariable(self::AFF_EMAIL, trim($this->user->getEmail()));
     $this->setVariable(self::AFF_IP, Gpf_Http::getRemoteIp());
     
     $this->setVariable(AutoResponsePlus_Config::NAME, $this->getSettingForSubject(AutoResponsePlus_Config::NAME));
     $this->setVariable(AutoResponsePlus_Config::PASSWORD, $this->getSettingForSubject(AutoResponsePlus_Config::PASSWORD));
     $this->setVariable(AutoResponsePlus_Config::AUTORESPONDER_ADDRESS, $this->getSettingForSubject(AutoResponsePlus_Config::AUTORESPONDER_ADDRESS));
     $this->setVariable(AutoResponsePlus_Config::HTML, (Gpf_Settings::get(AutoResponsePlus_Config::HTML) == Gpf::YES ? 'html' : 'plain'));
     $this->setVariable(AutoResponsePlus_Config::TRACKING_TAB, $this->getSettingForSubject(AutoResponsePlus_Config::TRACKING_TAB));
     $this->setVariable(AutoResponsePlus_Config::DROP_RULES, (Gpf_Settings::get(AutoResponsePlus_Config::DROP_RULES) == Gpf::YES ? 'yes' : 'no'));
 }
示例#4
0
 public function getIP()
 {
     if ($this->getForcedIp() !== '') {
         return $this->getForcedIp();
     }
     return Gpf_Http::getRemoteIp();
 }
示例#5
0
 protected function getIp() {
 	return @Gpf_Http::getRemoteIp();
 }
示例#6
0
    public function getDefaultCountry(Gpf_Plugins_ValueContext $valueContext) {
        $ip = Gpf_Http::getRemoteIp();
        if (!strlen($ip) || $ip == '127.0.0.1') {
            return;
        }

        try {
            $location = new GeoIp_Location();
            $location->setIpString($ip);
            $location->load();
            $valueContext->set($location->getCountryCode());
        } catch (Exception $e) {
        }
    }
 protected function insertTransaction($affiliateId, $type, $commissionValue, $status, Gpf_Data_Record $commission = null) {
     if ($affiliateId == null) {
         return;
     }
     $transaction = new Pap_Common_Transaction();
     $transaction->setUserId($affiliateId);
     $transaction->setType($type);
     if ($commission != null) {
         $transaction->setTier($commission->get(Pap_Db_Table_Commissions::TIER));
     } else {
         $transaction->setTier('1');
     }
     $transaction->setStatus($status);
     $transaction->setPayoutStatus('U');
     $transaction->setDateInserted(Gpf_Common_DateUtils::now());
     $transaction->setCommission($commissionValue);
     $transaction->setData5($this->user->getId());
     $transaction->setIp(Gpf_Http::getRemoteIp());
     $transaction->insert();
 }
示例#8
0
 /**
  * logs message
  *
  * @param string $message
  * @param string $logLevel
  * @param string $logGroup
  */
 public function log($message, $logLevel, $logGroup = null)
 {
     $time = time();
     $group = $logGroup;
     if ($this->group !== null) {
         $group = $this->group;
         if ($logGroup !== null) {
             $group .= ' ' . $logGroup;
         }
     }
     $callingFile = $this->findLogFile();
     $file = $callingFile['file'];
     if (isset($callingFile['classVariables'])) {
         $file .= ' ' . $callingFile['classVariables'];
     }
     $line = $callingFile['line'];
     $ip = Gpf_Http::getRemoteIp();
     if ($ip = '') {
         $ip = '127.0.0.1';
     }
     foreach ($this->loggers as $logger) {
         if (!in_array($logger->getType(), $this->disabledTypes)) {
             $logger->logMessage($time, $message, $logLevel, $group, $ip, $file, $line, $this->type);
         }
     }
 }
 /**
  * 
  * @return Pap_Db_Visit
  */
 protected function createVisit() {
     $visit = new Pap_Db_Visit(Gpf_Settings::get(Pap_Settings::VISITS_TABLE_INPUT));
     $visit->setSaleParams($this->getJSONsale());
     $visit->setCookies($this->getCookieParams());
     $visit->setVisitorId($this->getVisitorId());
     $visit->setAccountId($this->getAccountId());
     $visit->setTrackMethod($this->getTrackMethod());
     $visit->setIp(@Gpf_Http::getRemoteIp());
     $visit->setUserAgent(@$_SERVER['HTTP_USER_AGENT']);
     $visit->setDateVisit(Gpf_Common_DateUtils::now());
     $visit->setReferrerUrl($this->referrer);
     $visit->setVisitorIdHash(sprintf('%u', crc32($this->getVisitorId())) % 255);
     return $visit;
 }
    protected function checkBeforeSave($row, Gpf_Rpc_Form $form, $operationType = self::EDIT) {
        $result = parent::checkBeforeSave($row, $form, $operationType);

        if (!$this->isFromApi) {
            Gpf_Plugins_Engine::extensionPoint('Pap_Signup_AffiliateForm.checkBeforeSaveNotApi', $form);
            if ($form->isError()) {
                $result = false; 
            }
        }

        $context = new Pap_Signup_SignupFormContext(Gpf_Http::getRemoteIp(), $form, $row);
        $fraudProtectionObj = new Pap_Signup_FraudProtection();
        $fraudProtectionObj->check($context);

        return $result && $context->isSaveAllowed();
    }
示例#11
0
 /**
  *
  * @param Gpf_Rpc_Form $loginForm
  * @param Gpf_Auth_Info $authInfo
  * @return Gpf_Rpc_Serializable
  */
 protected function authenticateUser(Gpf_Rpc_Form $loginForm, Gpf_Auth_Info $authInfo)
 {
     $authUser = $this->loadUser($authInfo);
     Gpf_Session::getInstance()->save($authUser);
     $this->setAuthenticationSucesful($loginForm, $authUser);
     Gpf_Session::getInstance()->getAuthUser()->updateIp(Gpf_Http::getRemoteIp());
     return $loginForm;
 }