Page 1 of 1

ip2long function help

Posted: Wed Dec 15, 2010 1:38 am
by tomindo
it does not echo the ip conversions. I tried without ip2long functino , it worked fine

Code: Select all

<form method="post" action="test.php"> 
<textarea name="new" cols="40" rows="10"> 
samplehost-1,127.0.0.1
samplehost-2,127.0.0.2
</textarea><br>
<input type="submit" value="Add Servers"> 
</form>
<?phpif(isset($_POST['new'])) {
	$array= explode("\n",$_POST['new']);
	foreach ($array as $ni) {
				$array=explode(',', $ni);
				echo ip2long($array[1]);	
}
}
?>

Re: ip2long function help

Posted: Wed Dec 15, 2010 1:57 am
by Darhazer
most likely, ip2long returns false, and this is why echo does not work
you can use var_dump() to check
The same way check the value of $array[1]

Re: ip2long function help

Posted: Wed Dec 15, 2010 9:34 am
by tomindo
thanks