Skip to content

Commit 6d08b3e

Browse files
authored
Merge pull request #27 from gavinjackson/master
Check that customer IP address is present (and increment version)
2 parents a30df99 + a8852c6 commit 6d08b3e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PHP API Library for Fat Zebra
22
==============================
33

4-
Release 1.2.2 for API version 1.0
4+
Release 1.2.3 for API version 1.0
55

66
A PHP library for the [Fat Zebra](https://www.fatzebra.com.au) Online Payment Gateway (for Australian Merchants)
77
Now supports recurring billing (subscriptions, plans, customers)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fatzebra/fatzebra-php",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"repositories": [
55
{
66
"type": "vcs",

src/Gateway.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,15 +528,15 @@ protected function do_request($method, $uri, $payload = null)
528528
*/
529529
private function get_customer_ip()
530530
{
531-
$customer_ip = $_SERVER['REMOTE_ADDR'];
531+
532+
$customer_ip = "UNKNOWN";
533+
if (isset($_SERVER['REMOTE_ADDR'])) {
534+
$customer_ip = $_SERVER['REMOTE_ADDR'];
535+
}
532536
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
533537
$forwarded_ips = explode(', ', $_SERVER['HTTP_X_FORWARDED_FOR']);
534538
$customer_ip = $forwarded_ips[0];
535539
}
536-
537-
if ($customer_ip == null) {
538-
$customer_ip = 'UNKNOWN';
539-
}
540540
return $customer_ip;
541541
}
542542

0 commit comments

Comments
 (0)