LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Capturing client ip address at linux server (https://www.linuxquestions.org/questions/programming-9/capturing-client-ip-address-at-linux-server-630193/)

arsridhar 03-24-2008 05:27 AM

Capturing client ip address at linux server
 
I have my clients running on windows /linux and my servers are on linux RHEL AS 4.

how do i capture the client ip addresses at the server?

based on the information of the client IPs, i intend to restrict access to various oracle forms on my application server.

Sree

acid_kewpie 03-24-2008 06:30 AM

you need to explain what "capture" actually means... you need this information to actually be usable in some way? well there are many many ways to "capture" an ip address, some useful, most not i expect...

arsridhar 03-24-2008 07:24 AM

Quote:

Originally Posted by acid_kewpie (Post 3098592)
you need to explain what "capture" actually means... you need this information to actually be usable in some way? well there are many many ways to "capture" an ip address, some useful, most not i expect...


By capturing I mean , get the ip address of the client machine. This information, i.e.e the ip address will be used to restrict access to the oracle forms loaded on my application server. (my application server is on RH EL 4 AS 4).

acid_kewpie 03-24-2008 08:49 AM

yes i know what the dictionary definition of "capture" is... where do you want to use this information? is it with a PHP script? within a firewall??

arsridhar 03-25-2008 01:19 AM

Quote:

Originally Posted by acid_kewpie (Post 3098712)
yes i know what the dictionary definition of "capture" is... where do you want to use this information? is it with a PHP script? within a firewall??

i am sorry for having given the dictionary meaning.

i want to use the information to prevent access to a oracle form from a range of ip's or selected ip's. i have been given the solution to implement the restriction. the solution is as below.

The easiest most straight forward way would be to grab the http variable for REMOTE_IP, then do a switch in your code.

in pseudo code:

$ipaddress = REMOTE_IP
if($ipaddress==$ip1 || $ipaddress==$ip2 [etc])
{
//show form
}
else
{
print "access denied"
}


Here, i would like to know, where is the pseudo code and how to grab the http variable for REMOTE_IP.

to be more clear, if i restrict access from an ip for e.g 192.168.0.1 in hosts.deny/allow files, how does the OS check the ip of the client machine requesting access to implement the restriction.

i hope i have put the requirements clearly.

acid_kewpie 03-25-2008 06:12 AM

ugghh, finally you're asking a PHP question...

so 3 seconds on google would have told you to use $_SERVER['REMOTE_ADDR'] as for the use of that data, you seem ware enough on PHP to do that part.


All times are GMT -5. The time now is 01:38 PM.