File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -242,16 +242,22 @@ private function logPostedData()
242242
243243 protected function getIp ()
244244 {
245+ $ ip = null ;
246+
245247 if (!empty ($ _SERVER ['HTTP_CF_CONNECTING_IP ' ])) {
246- return $ _SERVER ['HTTP_CF_CONNECTING_IP ' ];
248+ $ ip = $ _SERVER ['HTTP_CF_CONNECTING_IP ' ];
247249 }
248250 if (!empty ($ _SERVER ['HTTP_X_FORWARDED_FOR ' ])) {
249- return $ _SERVER ['HTTP_X_FORWARDED_FOR ' ];
251+ $ ip = $ _SERVER ['HTTP_X_FORWARDED_FOR ' ];
250252 }
251253 if (!empty ($ _SERVER ['REMOTE_ADDR ' ])) {
252- return $ _SERVER ['REMOTE_ADDR ' ];
254+ $ ip = $ _SERVER ['REMOTE_ADDR ' ];
253255 }
254- return null ;
256+
257+ // If there are multiple proxies, X_FORWARDED_FOR is a comma and space separated list of IPs
258+ $ ip = explode (', ' , $ ip );
259+
260+ return $ ip [0 ];
255261 }
256262
257263 /**
You can’t perform that action at this time.
0 commit comments