API16

JLDAP/ipToNetAddress

From Joomla! Documentation

< API16:JLDAP

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Converts a dot notation IP address to net address (e.g. for Netware, etc)


<! removed transcluded page call, red link never existed >

Syntax[edit]

ipToNetAddress($ip)
Parameter Name Default Value Description
$ip IP Address (e.g. xxx.xxx.xxx.xxx)

Returns[edit]

string Net address public

Defined in[edit]

libraries/joomla/client/ldap.php

Importing[edit]

jimport( 'joomla.client.ldap' );

Source Body[edit]

function ipToNetAddress($ip)
{
        $parts = explode('.', $ip);
        $address = '1#';

        foreach ($parts as $int) {
                $tmp = dechex($int);
                if (strlen($tmp) != 2) {
                        $tmp = '0' . $tmp;
                }
                $address .= '\\' . $tmp;
        }
        return $address;
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]