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


PHP ip_address函数代码示例

本文整理汇总了PHP中ip_address函数的典型用法代码示例。如果您正苦于以下问题:PHP ip_address函数的具体用法?PHP ip_address怎么用?PHP ip_address使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: generateIdentifier

 /**
  * {@inheritdoc}
  */
 public function generateIdentifier($account = NULL)
 {
     $identifier = '';
     $identifier .= $this->getPluginId() . PluginBase::DERIVATIVE_SEPARATOR;
     $identifier .= empty($account->uid) ? ip_address() : $account->uid;
     return $identifier;
 }
开发者ID:jhoffman-tm,项目名称:waldorf-deployment,代码行数:10,代码来源:RateLimitGlobal.php

示例2: updateCreditCardCustomer

 protected function updateCreditCardCustomer($params)
 {
     require_once "CRM/iATS/iATSService.php";
     $credentials = iATS_Service_Request::credentials($params['paymentProcessorId'], $params['is_test']);
     unset($params['paymentProcessorId']);
     unset($params['is_test']);
     unset($params['domain']);
     $iats_service_params = array('type' => 'customer', 'iats_domain' => $credentials['domain'], 'method' => 'update_credit_card_customer');
     $iats = new iATS_Service_Request($iats_service_params);
     // print_r($iats); die();
     $params['updateCreditCardNum'] = 0 < strlen($params['creditCardNum']) && FALSE === strpos($params['creditCardNum'], '*') ? 1 : 0;
     if (empty($params['updateCreditCardNum'])) {
         unset($params['creditCardNum']);
         unset($params['updateCreditCardNum']);
     }
     $params['customerIPAddress'] = function_exists('ip_address') ? ip_address() : $_SERVER['REMOTE_ADDR'];
     foreach (array('qfKey', 'entryURL', 'firstName', 'lastName', '_qf_default', '_qf_IATSCustomerLink_submit') as $key) {
         if (isset($params[$key])) {
             unset($params[$key]);
         }
     }
     // make the soap request
     $response = $iats->request($credentials, $params);
     $result = $iats->result($response, TRUE);
     // note: don't log this to the iats_response table
     return $result;
 }
开发者ID:Prem-Patel,项目名称:com.iatspayments.civicrm,代码行数:27,代码来源:IATSCustomerLink.php

示例3: sess_write

function sess_write($key, $value)
{
    global $perfil, $cfg;
    $mysql = new MYSQL($cfg);
    // If saving of session data is disabled or if the client doesn't have a session,
    // and one isn't being created ($value), do nothing. This keeps crawlers out of
    // the session table. This reduces memory and server load, and gives more useful
    // statistics. We can't eliminate anonymous session table rows without breaking
    // the throttle module and the "Who's Online" block.
    if (!session_save_session() || $perfil->ID_USER == 0 && empty($_COOKIE[session_name()]) && empty($value)) {
        return TRUE;
    }
    $mysql->SqlSelect("UPDATE {sessions} SET ID_USER = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE ID_SESSION = '%s'", $perfil->ID_USER, isset($perfil->cache) ? $perfil->cache : '', ip_address(), $value, time(), $key);
    if (mysql_affected_rows()) {
        // Last access time is updated no more frequently than once every 180 seconds.
        // This reduces contention in the users table.
        if ($perfil->ID_USER && time() - $perfil->access > variable_get('session_write_interval', 180)) {
            $mysql->SqlSelect("UPDATE {users} SET access = %d WHERE ID_USER = %d", time(), $perfil->ID_USER);
        }
    } else {
        // If this query fails, another parallel request probably got here first.
        // In that case, any session data generated in this request is discarded.
        @$mysql->SqlSelect("INSERT INTO {sessions} (ID_SESSION, ID_USER, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $perfil->ID_USER, isset($perfil->cache) ? $perfil->cache : '', ip_address(), $value, time());
    }
    return TRUE;
}
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:26,代码来源:fnc.Session.php

示例4: write

 public function write($sessionId, $serializedData)
 {
     try {
         // For performance reasons, do not update the sessions table, unless
         // $_SESSION has changed or more than 180 has passed since the last update.
         if ($this->sessionDataHasChanged($sessionId, $serializedData)) {
             // Either ssid or sid or both will be added from $key below.
             $fields = array('uid' => $this->uid, 'cache' => 0, 'hostname' => ip_address(), 'session' => $serializedData, 'timestamp' => REQUEST_TIME);
             $key = array('sid' => $sessionId, 'ssid' => '');
             db_merge('sessions')->key($key)->fields($fields)->execute();
         }
         return TRUE;
     } catch (Exception $exception) {
         // FIXME: This should never be here, a global try/catch should definitely
         // be done upper in the code.
         require_once DRUPAL_ROOT . '/includes/errors.inc';
         // If we are displaying errors, then do so with no possibility of a further
         // uncaught exception being thrown.
         if (error_displayable()) {
             print '<h1>Uncaught exception thrown in session handler.</h1>';
             print '<p>' . _drupal_render_exception_safe($exception) . '</p><hr />';
         }
         return FALSE;
     }
 }
开发者ID:swarad07,项目名称:node_redis,代码行数:25,代码来源:Database.php

示例5: __construct

 public function __construct()
 {
     $this->UserIPAdd = ip_address();
     $this->UserBrowser = user_agent();
     $this->DB =& load_class('Database');
     $this->ENC =& load_class('Encryption');
     $this->SESS =& load_class('Session');
 }
开发者ID:puncoz,项目名称:puncoz_accnt,代码行数:8,代码来源:user.php

示例6: doDirectPayment

 function doDirectPayment(&$params)
 {
     if (!$this->_profile) {
         return self::error('Unexpected error, missing profile');
     }
     // use the iATSService object for interacting with iATS, mostly the same for recurring contributions
     require_once "CRM/iATS/iATSService.php";
     // TODO: force bail if it's not recurring?
     $isRecur = CRM_Utils_Array::value('is_recur', $params) && $params['contributionRecurID'];
     $method = $isRecur ? 'acheft_create_customer_code' : 'acheft';
     // to add debugging info in the drupal log, assign 1 to log['all'] below
     $iats = new iATS_Service_Request(array('type' => 'process', 'method' => $method, 'iats_domain' => $this->_profile['iats_domain'], 'currencyID' => $params['currencyID']));
     $request = $this->convertParams($params, $method);
     $request['customerIPAddress'] = function_exists('ip_address') ? ip_address() : $_SERVER['REMOTE_ADDR'];
     $credentials = array('agentCode' => $this->_paymentProcessor['user_name'], 'password' => $this->_paymentProcessor['password']);
     // Get the API endpoint URL for the method's transaction mode.
     // TODO: enable override of the default url in the request object
     // $url = $this->_paymentProcessor['url_site'];
     // make the soap request
     $response = $iats->request($credentials, $request);
     // process the soap response into a readable result
     $result = $iats->result($response);
     if ($result['status']) {
         $params['contribution_status_id'] = 2;
         // always pending status
         $params['payment_status_id'] = 2;
         // for future versions, the proper key
         $params['trxn_id'] = trim($result['remote_id']) . ':' . time();
         $params['gross_amount'] = $params['amount'];
         if ($isRecur) {
             // save the client info in my custom table
             // Allow further manipulation of the arguments via custom hooks,
             // before initiating processCreditCard()
             // CRM_Utils_Hook::alterPaymentProcessorParams($this, $params, $iatslink1);
             $processresult = $response->PROCESSRESULT;
             $customer_code = (string) $processresult->CUSTOMERCODE;
             // $exp = sprintf('%02d%02d', ($params['year'] % 100), $params['month']);
             $exp = '0000';
             $email = '';
             if (isset($params['email'])) {
                 $email = $params['email'];
             } elseif (isset($params['email-5'])) {
                 $email = $params['email-5'];
             } elseif (isset($params['email-Primary'])) {
                 $email = $params['email-Primary'];
             }
             $query_params = array(1 => array($customer_code, 'String'), 2 => array($request['customerIPAddress'], 'String'), 3 => array($exp, 'String'), 4 => array($params['contactID'], 'Integer'), 5 => array($email, 'String'), 6 => array($params['contributionRecurID'], 'Integer'));
             CRM_Core_DAO::executeQuery("INSERT INTO civicrm_iats_customer_codes\n          (customer_code, ip, expiry, cid, email, recur_id) VALUES (%1, %2, %3, %4, %5, %6)", $query_params);
             // also set next_sched_contribution, the field name is civicrm version dependent
             $field_name = _iats_civicrm_nscd_fid();
             $params[$field_name] = strtotime('+' . $params['frequency_interval'] . ' ' . $params['frequency_unit']);
         }
         return $params;
     } else {
         return self::error($result['reasonMessage']);
     }
 }
开发者ID:colemanw,项目名称:com.iatspayments.civicrm,代码行数:57,代码来源:iATSServiceACHEFT.php

示例7: authenticate

 /**
  * {@inheritdoc}
  *
  * @see user_login_authenticate_validate().
  */
 public function authenticate(RequestInterface $request)
 {
     $username = $request->getUser();
     $password = $request->getPassword();
     // Do not allow any login from the current user's IP if the limit has been
     // reached. Default is 50 failed attempts allowed in one hour. This is
     // independent of the per-user limit to catch attempts from one IP to log
     // in to many different user accounts.  We have a reasonably high limit
     // since there may be only one apparent IP for all users at an institution.
     if (!flood_is_allowed('failed_login_attempt_ip', variable_get('user_failed_login_ip_limit', 50), variable_get('user_failed_login_ip_window', 3600))) {
         throw new FloodException(format_string('Rejected by ip flood control.'));
     }
     if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
         if (!($uid = db_query_range("SELECT uid FROM {users} WHERE LOWER(mail) = LOWER(:mail) AND status = 1", 0, 1, array(':mail' => $username))->fetchField())) {
             // Always register an IP-based failed login event.
             flood_register_event('failed_login_attempt_ip', variable_get('user_failed_login_ip_window', 3600), ip_address());
             return null;
         } else {
             $username = db_query_range("SELECT name FROM {users} WHERE LOWER(mail) = LOWER(:mail) AND status = 1", 0, 1, array(':mail' => $username))->fetchField();
         }
     } else {
         if (!($uid = db_query_range("SELECT uid FROM {users} WHERE name = :name AND status = 1", 0, 1, array(':name' => $username))->fetchField())) {
             // Always register an IP-based failed login event.
             flood_register_event('failed_login_attempt_ip', variable_get('user_failed_login_ip_window', 3600), ip_address());
             return null;
         }
     }
     if (variable_get('user_failed_login_identifier_uid_only', false)) {
         // Register flood events based on the uid only, so they apply for any
         // IP address. This is the most secure option.
         $identifier = $uid;
     } else {
         // The default identifier is a combination of uid and IP address. This
         // is less secure but more resistant to denial-of-service attacks that
         // could lock out all users with public user names.
         $identifier = $uid;
         // . '-' . ip_address();
     }
     // Don't allow login if the limit for this user has been reached.
     // Default is to allow 5 failed attempts every 6 hours.
     if (flood_is_allowed('failed_login_attempt_user', variable_get('user_failed_login_user_limit', 5), variable_get('user_failed_login_user_window', 21600), $identifier)) {
         // We are not limited by flood control, so try to authenticate.
         if ($uid = user_authenticate($username, $password)) {
             // Clear the user based flood control.
             flood_clear_event('failed_login_attempt_user', $identifier);
             $user = user_load($uid);
             return user_load($uid);
         }
         flood_register_event('failed_login_attempt_user', variable_get('user_failed_login_user_window', 3600), $identifier);
     } else {
         flood_register_event('failed_login_attempt_user', variable_get('user_failed_login_user_window', 3600), $identifier);
         throw new FloodException(format_string('Rejected by user flood control.'));
     }
 }
开发者ID:riccardoravaro,项目名称:restfull_toboggan,代码行数:59,代码来源:BasicAuthenticationToboggan.php

示例8: _write

 public function _write($session_id, $user_data)
 {
     if (!count($this->session_exists($session_id))) {
         $args = array(':session_id' => $session_id, ':ip_address' => ip_address(), ':user_agent' => user_agent(), ':last_activity' => time(), ':user_data' => serialize($user_data));
         $query = "REPLACE INTO sessions (session_id, ip_address, user_agent, last_activity, user_data) VALUES (:session_id, :ip_address, :user_agent, :last_activity, :user_data)";
     } else {
         $args = array(':session_id' => $session_id, ':user_data' => serialize($user_data));
         $query = "UPDATE sessions SET user_data = :user_data WHERE session_id = :session_id";
     }
     return $this->db->query($query, $args);
 }
开发者ID:jabouzi,项目名称:usermanager,代码行数:11,代码来源:session.php

示例9: run

 function run()
 {
     // generate json output from iats service calls
     $request = $_POST;
     $pp_id = (int) $request['payment_processor_id'];
     if (empty($pp_id)) {
         return;
     }
     $params = array('version' => 3, 'sequential' => 1, 'id' => $pp_id, 'return' => 'user_name');
     $result = civicrm_api('PaymentProcessor', 'getvalue', $params);
     $request['agentCode'] = $result;
     $params = array('version' => 3, 'sequential' => 1, 'id' => $pp_id, 'return' => 'url_site');
     $result = civicrm_api('PaymentProcessor', 'getvalue', $params);
     $request['iats_domain'] = parse_url($result, PHP_URL_HOST);
     foreach (array('reset', 'q', 'IDS_request_uri', 'IDS_user_agent', 'payment_processor_id') as $key) {
         if (isset($request[$key])) {
             unset($request[$key]);
         }
     }
     $options = array();
     foreach (array('type', 'method', 'iats_domain') as $key) {
         if (isset($request[$key])) {
             $options[$key] = $request[$key];
             unset($request[$key]);
         }
     }
     $credentials = array();
     foreach (array('agentCode', 'password') as $key) {
         if (isset($request[$key])) {
             $credentials[$key] = $request[$key];
             unset($request[$key]);
         }
     }
     // TODO: bail here if I don't have enough for my service request
     // use the iATSService object for interacting with iATS
     require_once "CRM/iATS/iATSService.php";
     $iats = new iATS_Service_Request($options);
     $request['customerIPAddress'] = function_exists('ip_address') ? ip_address() : $_SERVER['REMOTE_ADDR'];
     // make the soap request
     $response = $iats->request($credentials, $request);
     // process the soap response into a readable result
     if (!empty($response)) {
         $result = $iats->result($response);
     } else {
         $result = array('Invalid request');
     }
     // TODO: fix header
     // header('Content-Type: text/javascript');
     echo json_encode(array_merge($result));
     exit;
 }
开发者ID:colemanw,项目名称:com.iatspayments.civicrm,代码行数:51,代码来源:json.php

示例10: fiftyone_degrees_SendDetails

/**
 * Sends usage details to 51Degrees.mobi.
 *
 * Sends usage details to 51Degrees.mobi about the request for subsequent
 * analysis and product improvement.
 */
function fiftyone_degrees_SendDetails()
{
    if (session_status() == PHP_SESSION_NONE) {
        session_start();
    }
    $details_sent = FALSE;
    if (array_key_exists('fiftyone_degrees_details_sent', $_SESSION)) {
        $details_sent = $_SESSION['fiftyone_degrees_details_sent'] === TRUE;
    }
    if (!$details_sent && (extension_loaded('sockets') || extension_loaded('php_sockets'))) {
        $server_ip = 'udp.devices.51degrees.mobi';
        $server_port = 80;
        // Get the ip address of the requesting client.
        if (function_exists('ip_address')) {
            // Used if Drupal (or others) have ip_address method.
            $ip = ip_address();
        } elseif (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip = $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip = $_SERVER['REMOTE_ADDR'];
        }
        $server_ip = $_SERVER['SERVER_ADDR'];
        // Construct the XML message.
        $message = '<?xml version="1.0" encoding="utf-16"?>
            <Device>
            <DateSent>' . gmdate('c') . '</DateSent>
            <Product>51degrees - Foundation - PHP</Product>
            <Version>3.1.2.1</Version>
            <ClientIP>' . $ip . '</ClientIP>
            <ServerIP>' . $server_ip . '</ServerIP>';
        // Add the headers to the information being sent.
        $headers = fiftyone_degrees_GetHeaders();
        foreach ($headers as $servervar => $val) {
            if (strtolower($servervar) == "referer" || strtolower($servervar) == "cookie") {
                $message .= '<Header Name="' . $servervar . '"></Header>';
            } else {
                $message .= '<Header Name="' . $servervar . '"><![CDATA[' . $val . ']]></Header>';
            }
        }
        $message .= '</Device>';
        // Send a UDP packet with the xml content.
        @($socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP));
        if ($socket) {
            @socket_sendto($socket, $message, strlen($message), 0, $server_ip, $server_port);
        }
        $_SESSION['fiftyone_degrees_details_sent'] = TRUE;
    }
}
开发者ID:sergey-konovalov,项目名称:51Degrees-PHP,代码行数:56,代码来源:51Degrees_usage.php

示例11: login

 public function login($data, $session = true)
 {
     // Check if e-mail exists.
     $member = $this->get_member('email', $data['email']);
     if (!$member) {
         // Log unsuccessful logins for sessions.
         if ($session) {
             $this->db->insert('logins', array('ip_address' => ip_address(), 'timestamp' => time()));
         }
         // That's a negative
         return false;
     }
     // If we're going to set a session, check that member is an admin or boardmember
     if ($session && !$this->is_boardmember($member->id) && !$this->is_admin($member->id)) {
         return false;
     }
     // Load password library
     $this->load->library('Pass');
     // Verify password
     $result = $this->pass->verify($data['password'], $member->password);
     if (!$result) {
         // Log unsuccessful login to database
         $this->db->insert('logins', array('member_id' => $member->id, 'ip_address' => ip_address(), 'timestamp' => time()));
         return false;
     }
     // Check if wanna start a session or not
     if ($session) {
         // Set session
         $userdata = array('member_id' => $member->id, 'email' => $data['email'], 'logged_in' => true);
         if (!empty($data['remember'])) {
             $userdata['remember_me'] = true;
         }
         $this->session->set_userdata($userdata);
         // Log successful login in database
         $this->db->insert('logins', array('member_id' => $member->id, 'ip_address' => ip_address(), 'timestamp' => time(), 'valid' => 1));
         // Failsafe
         return is_loggedin();
     } else {
         // No session, but return true
         return true;
     }
     return false;
 }
开发者ID:johusman,项目名称:internal,代码行数:43,代码来源:member_model.php

示例12: send_forgot_password

    public function send_forgot_password($to, $token, $recipient_name = '')
    {
        $subject = 'Password recovery for internal.makerspace.se';
        $template = 'Hello!

A password recovery reset has been sent from IP-address: %s.
If you did not ask for a password reset, you can safely ignore this email.

To reset your password, please visit this page:
https://internal.makerspace.se/auth/reset/%s

--
Regards, E-mail Robot
Stockholm Makerspace';
        // New email
        $email = $this->new_email($to, $recipient_name);
        $body = sprintf($template, ip_address(), $token);
        // Set subject
        $email->Subject = $subject;
        // Set body.
        $email->Body = $body;
        return $email->Send();
    }
开发者ID:johusman,项目名称:internal,代码行数:23,代码来源:email_model.php

示例13: sess_update

 /**
  * Update an existing session
  *
  * @access	public
  * @return	void
  */
 function sess_update()
 {
     // We only update the session every five minutes by default
     if ($this->userdata['last_activity'] + $this->sess_time_to_update >= $this->now) {
         return;
     }
     // Save the old session id so we know which record to
     // update in the database if we need it
     $old_sessid = $this->userdata['session_id'];
     $new_sessid = '';
     while (strlen($new_sessid) < 32) {
         $new_sessid .= mt_rand(0, mt_getrandmax());
     }
     // To make the session ID even more secure we'll combine it with the user's IP
     $new_sessid .= ip_address();
     // Turn it into a hash
     $new_sessid = md5(uniqid($new_sessid, TRUE));
     // Update the session data in the session data array
     $this->userdata['session_id'] = $new_sessid;
     $this->userdata['last_activity'] = $this->now;
     // _set_cookie() will handle this for us if we aren't using database sessions
     // by pushing all userdata to the cookie.
     $cookie_data = NULL;
     // Write the cookie
     $this->_set_cookie($cookie_data);
 }
开发者ID:puncoz,项目名称:presentation,代码行数:32,代码来源:session.php

示例14: exit

if (!file_exists('includes/bootstrap.inc')) {
  exit('Can not find Drupal directory.');
}

// Running full Drupal bootstrap
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$safety       = isset($_GET['safety']) ? $_GET['safety'] : '';
$valid_safety = $safety === variable_get(SUPERCRON_SAFETY_VARIABLE, NULL);

// IP authorization check
if (variable_get(SUPERCRON_FIREWALL_ENABLED_VARIABLE, FALSE)) {
  $mode   = variable_get(SUPERCRON_FIREWALL_MODE_VARIABLE, 'only');
  $ip     = ip_address();
  if (is_null($ip)) $ip = '127.0.0.1'; // bash calls return a null calling IP
  $result = db_query('SELECT * FROM {supercron_ips}');
  
  $authorized = $mode === 'except';
  while ($dbip = db_fetch_object($result)) {
    if ($ip == $dbip->ip) {
      $authorized = $mode === 'only';
      break;
    }
  }

  if (!$authorized) {
    exit("IP '$ip' not authorized!");
  }
}
开发者ID:nbcutech,项目名称:o3drupal,代码行数:30,代码来源:supercron.php

示例15: requestBuild

 /**
  * Web Service: Build JSON request parameters
  *
  * Assumes request has been validated.
  *
  * @param $request_state
  *   @see CommerceFirstDataGGE4Controller::resolvePaymentState()
  *
  * @return
  *   A name-value pair array for a JSON request
  */
 protected function requestBuild(&$request_state)
 {
     // Resolve state
     $this->controller->resolvePaymentState($request_state);
     // Set local vars for easy reference
     $charge = $request_state['charge'];
     $card = $request_state['card'];
     $order = $request_state['order'];
     $billing_address = $request_state['billing_address'];
     $prev_transaction = $request_state['previous_transaction'];
     // load transaction type info
     $txn_type_info = $this->controller->transactionType($request_state['txn_type']);
     // Add build info with request indicators
     $request_state['build_info'] = array('zero_amount' => commerce_firstdata_gge4_is_zero($charge['amount']));
     // Zero Dollar Pre-Authorizations
     if ($request_state['txn_type'] != FIRSTDATA_GGE4_CREDIT_PREAUTH_ONLY && $request_state['build_info']['zero_amount'] && !empty($txn_type_info['zero_auth_allowed'])) {
         $request_state['txn_type'] = FIRSTDATA_GGE4_CREDIT_PREAUTH_ONLY;
         $txn_type_info = $this->controller->transactionType($request_state['txn_type']);
     }
     // Convert Commerce txn type to gateway code
     $request_state['gateway_txn_type'] = $txn_type_info['gateway_code'];
     // Set transaction type
     $txn_type_code = $request_state['txn_type'];
     // Initialize request parameters
     $params = array('transaction_type' => $request_state['gateway_txn_type']);
     // Determine charge context
     $params += array('amount' => !$request_state['build_info']['zero_amount'] ? commerce_currency_amount_to_decimal($charge['amount'], $charge['currency_code']) : 0, 'currency_code' => $charge['currency_code']);
     // Parameters required per txn type
     if (!empty($txn_type_info['requires_card'])) {
         // Purchase, Pre-auth, Pre-auth only, Refund via credit card
         // Billing address parameters
         if (!empty($billing_address)) {
             $params['zip_code'] = substr($billing_address['postal_code'], 0, 10);
             // cc_verification_str1: "Street Address|Zip/Postal|City|State/Prov|Country"
             $billing_address_verify_parts = array($billing_address['street_line'], $billing_address['postal_code'], $billing_address['locality'], $billing_address['administrative_area'], $billing_address['country']);
             $params['cc_verification_str1'] = implode('|', $billing_address_verify_parts);
             $params['cc_verification_str1'] = substr($params['cc_verification_str1'], 0, 41);
         }
         // Add expiration
         $params += array('cc_expiry' => str_pad($card->card_exp_month, 2, '0', STR_PAD_LEFT) . substr($card->card_exp_year, -2));
         // Add cardholder name
         $cardholder_name = '';
         if (!empty($card->card_name)) {
             // Set to name on card
             $cardholder_name = $card->card_name;
         } elseif (!empty($billing_address['name_line'])) {
             // Set to billing address name
             $cardholder_name = $billing_address['name_line'];
         }
         $card->card_name = $params['cardholder_name'] = substr($cardholder_name, 0, 30);
         // Add additional card data
         $params += array('cc_number' => substr($card->card_number, 0, 16));
         // CVV code should only be available during checkout or new cards
         if (!empty($card->card_code)) {
             $params['cc_verification_str2'] = substr($card->card_code, 0, 4);
             $params['cvd_presence_ind'] = "1";
         }
     } elseif (!empty($txn_type_info['transaction_operation'])) {
         // Pre-auth capture, Void, Refund
         $params['authorization_num'] = substr($prev_transaction->data['authorization_num'], 0, 8);
         $params['transaction_tag'] = (int) $prev_transaction->data['transaction_tag'];
     }
     // Add order information
     if (!empty($order->order_number)) {
         $params['reference_no'] = $order->order_number;
     }
     // @todo: Level 2 order info - tax, etc
     // @todo: Level 3 order info - line items, etc
     // Add customer params
     if (isset($request_state['customer']->uid)) {
         $params['customer_ref'] = substr($request_state['customer']->uid, 0, 20);
     }
     if (isset($request_state['customer']->mail)) {
         $params['client_email'] = substr($request_state['customer']->mail, 0, 255);
     }
     $params['client_ip'] = substr(ip_address(), 0, 15);
     // Common parameters
     /** @todo use site or get from owner - order or card **/
     $params['language'] = $this->controller->convertLanguage(language_default('language'));
     // Allow other plugins and modules to alter
     $this->controller->alter('ws_request_build', $params, $request_state);
     return $params;
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:94,代码来源:CommerceFirstDataGGE4ComponentWS.class.php


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