Last active
April 14, 2022 02:51
-
-
Save rmdhfz/e13a82c71adb8788329403481bed7da6 to your computer and use it in GitHub Desktop.
Whitelist Incoming IP (midtrans) for Post Notification Payment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$RequestIP = (isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; | |
$IP_MIDTRANS = ['103\.208\..*', '103\.208\..*', '103\.127\..*', '103\.127\..*']; | |
if(!preg_match('/^(' . implode('|', $IP_MIDTRANS) . ')/', $RequestIP)){ | |
http_response_code(401); | |
return false; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment