API15

API15:JLDAP/ipToNetAddress

From Joomla! Documentation

Revision as of 22:14, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Converts a dot notation IP address to net address (e.g. for Netware, etc) <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JLDAP/ipT...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

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

[Edit Descripton]

Template:Description:JLDAP/ipToNetAddress

Syntax

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

Returns

string Net address public

Defined in

libraries/joomla/client/ldap.php

Importing

jimport( 'joomla.client.ldap' );

Source Body

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;
}

[Edit See Also] Template:SeeAlso:JLDAP/ipToNetAddress

Examples

<CodeExamplesForm />