ip adress returns 0.0.0.0 |
Hello guys,
I've a problem ! I want to get remote ip adress and when i use : <?php echo $this->input->ip_address();?> it returns me : 0.0.0.0 And when i try <?php echo $_SERVER['REMOTE_ADDR']; ;?> it returns nothing ... I'm using a dedicated server runing on plesk , on cent os !!! Do you have an idea about this thing ? Thanks !
It could be because your behind a proxy server or something else.
Try this and see what you get, if still 0 then look at your log files. PHP Code: function getRealIpAddr() What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Hello, and thank you for your help !
When i use your script outside of CI the $ip = $_SERVER['REMOTE_ADDR']; works ! When inside, it's not working ... Is it a CI configuration problem ?
You can have a look at my code : https://pastebin.com/xwPRhsJv (available for 1day)
This script should return false on ip check, but it still goes on ![]()
06-29-2017, 10:12 AM
(This post was last modified: 06-29-2017, 10:22 AM by InsiteFX. Edit Reason: Tested on system )
Add the method I gave you to a CI helper and then call it were your calling it in your controller and see if that works.
I just tried it on my system here and it works fine... What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-30-2017, 01:17 AM)Narf Wrote:(06-29-2017, 10:12 AM)InsiteFX Wrote: Add the method I gave you to a CI helper and then call it were your calling it in your controller and see if that works. Ok ok ![]()
Narf is correct on that one, I should have mentioned that!
I was stating to do that for testing your problem with the IP Address not for production Code. Thanks @Narf for clarifying that. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |