Actions

API16

JLDAP/ipToNetAddress

From Joomla! Documentation

< API16:JLDAP
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

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

[<! removed edit link to red link >]

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

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

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />