Skip to content

Commit

Permalink
Merge pull request #27 from gavinjackson/master
Browse files Browse the repository at this point in the history
Check that customer IP address is present (and increment version)
  • Loading branch information
amasses authored Apr 23, 2021
2 parents a30df99 + a8852c6 commit 6d08b3e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PHP API Library for Fat Zebra
==============================

Release 1.2.2 for API version 1.0
Release 1.2.3 for API version 1.0

A PHP library for the [Fat Zebra](https://www.fatzebra.com.au) Online Payment Gateway (for Australian Merchants)
Now supports recurring billing (subscriptions, plans, customers)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fatzebra/fatzebra-php",
"version": "1.2.2",
"version": "1.2.3",
"repositories": [
{
"type": "vcs",
Expand Down
10 changes: 5 additions & 5 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,15 @@ protected function do_request($method, $uri, $payload = null)
*/
private function get_customer_ip()
{
$customer_ip = $_SERVER['REMOTE_ADDR'];

$customer_ip = "UNKNOWN";
if (isset($_SERVER['REMOTE_ADDR'])) {
$customer_ip = $_SERVER['REMOTE_ADDR'];
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$forwarded_ips = explode(', ', $_SERVER['HTTP_X_FORWARDED_FOR']);
$customer_ip = $forwarded_ips[0];
}

if ($customer_ip == null) {
$customer_ip = 'UNKNOWN';
}
return $customer_ip;
}

Expand Down

0 comments on commit 6d08b3e

Please sign in to comment.