i have some records in table that there are some IP as records

but there is not any dot for split each section of per ip

as exmale: 217243541

is there any function in php to convert this records to ip with dot then show?

    The problem is, the program won't know what you want to interpret it as.

    Do you want it as 217.243.5.41 or 217.24.35.41 ?

    It's not just a simple "stick a dot in"

      The only solution to this is to have 4 text fields for each section of the ip address and set maxlength to 3 for each.
      Then assembly the content in the background.

      $ip = $field1.".".$field2.".".$field3.".".$field4;
      

        Are you sure it's not 12.242.223.149? Because if it is, then [man]ip2long[/man] and [man]long2ip[/man] would be involved. Unless the DBMS itself already has something to do the conversion (does it have an IP datatype?). Whoever is responsible for the code that puts the data into the database ought to know more.

          What is the Best way to get the REAL ip from visitor ?

            The 'real' IP is the IP the request was made from, you can use $_SERVER['REMOTE_ADDR'], but if they're using a proxy, you'll get the IP of the proxy.

              If they're using a proxy, it may still send $_SERVER['HTTP_X_FORWARDED_FOR'], so you can still get the users IP address.

                Write a Reply...