Hi does anybody have a ksh/sh/bash function that i can embed into my script that i could use to validate an inputted IP address, I tried using one big long regular expression but it got very long and complicated
ie
Assuming a dotted quad format:
Test $IP with:
Note, however, that other formats can be valid IP addresses.
Hi sir,
i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address.......
but i'm nt getting that how i can pass the MAC address to Frame........
Please give me an idea for making such program...
Thanks & regards
Krishna (3 Replies)
Hi there
I am running a script which requires the input of a MAC address from the user and was loooking for a regex that will verify the user has inputted a full 12 digit valid MAC with colons
Ive seen a few on some sites that look huge and was wondering if anybody had a one liner (or as... (21 Replies)
Hi,
Can anyone provide me the code snippet for EMail Address Validation.
User is going to enter the email address in form window. I need to validate the format is correct.
Thanks in Advance
BS (3 Replies)
Trying to do a ksh script that needs to list all ip address between ip address a and b ..
ie.
Ip address A=192.168.1.200
Ip address B=192.168.2.15
So the subnet changes from 1 to 2 but I want to list all possible ip addresses between the 2..
Which would be:
192.168.1.200... (4 Replies)
:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message:
PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14
KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD)
EAX=EF822000... (10 Replies)
Hi,
I am new to AIX and I am developing a small tool for our product which helps debug memory leaks etc.
Q1)Is there a way in which i can get a function trace back as to the call (lets say malloc() )has been made in which file--> in which function.
I tried using the
#pragma options (... (0 Replies)
Hi there
I lost connectivity to one of our remote systems and when I checked the messages log I found the following:
Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s
Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1
Aug 16 13:20:51 host... (9 Replies)
Hi ,
Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies
LEARN ABOUT PHP
ip2long
IP2LONG(3) 1 IP2LONG(3)ip2long - Converts a string containing an (IPv4) Internet Protocol dotted address into a proper addressSYNOPSIS
int ip2long (string $ip_address)
DESCRIPTION
The function ip2long(3) generates an IPv4 Internet network address from its Internet standard format (dotted string) representation.
ip2long(3) will also work with non-complete IP addresses. Read http://publibn.boul-
der.ibm.com/doc_link/en_US/a_doc_lib/libs/commtrf2/inet_addr.htm for more info.
PARAMETERS
o $ip_address
- A standard format address.
RETURN VALUES
Returns the IPv4 address or FALSE if $ip_address is invalid.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
|5.2.10 | |
| | |
| | Prior to this version, ip2long(3) would some- |
| | times return a valid number even if passed an |
| | value which was not an (IPv4) Internet Protocol |
| | dotted address. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
ip2long(3) Example
<?php
$ip = gethostbyname('www.example.com');
$out = "The following URLs are equivalent:<br />
";
$out .= 'http://www.example.com/, http://' . $ip . '/, and http://' . sprintf("%u", ip2long($ip)) . "/<br />
";
echo $out;
?>
Example #2
Displaying an IP address
This second example shows how to print a converted address with the printf(3) function in both PHP 4 and PHP 5:
<?php
$ip = gethostbyname('www.example.com');
$long = ip2long($ip);
if ($long == -1 || $long === FALSE) {
echo 'Invalid IP, please try again';
} else {
echo $ip . "
"; // 192.0.34.166
echo $long . "
"; // -1073732954
printf("%u
", ip2long($ip)); // 3221234342
}
?>
NOTES
Note
Because PHP's integer type is signed, and many IP addresses will result in negative integers on 32-bit architectures, you need to
use the "%u" formatter of sprintf(3) or printf(3) to get the string representation of the unsigned IP address.
Note
ip2long(3) will return FALSE for the IP 255.255.255.255 in PHP 5 <= 5.0.2. It was fixed in PHP 5.0.3 where it returns -1 (same as
PHP 4).
SEE ALSO long2ip(3), sprintf(3).
PHP Documentation Group IP2LONG(3)