<?php
function is_ipv6($ip){
$error = 1;
for($i = 3; $i <= 8; $i++){
if($i ==
count($explode2)){
$error = 0;
}
}
$num = 0;
$num = 0;
}else{
$num = 1;
}
foreach($explode2 as $ip_part){
if($num === 0 || $num === 1){
$num++;
}else{
$error = 1;
}
}else{
$hex =
Array( 0 =>
0,
1 =>
1,
2 =>
2,
3 =>
3,
4 =>
4,
5 =>
5,
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'a',
11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e',
15 => 'f' );
foreach($explode as $hex2){
$hex_is_wrong = 1;
foreach($hex as $hex3){
if($hex2 == $hex3){
$hex_is_wrong = 0;
}
}
if($hex_is_wrong === 1){
$error = 1;
}
}
}else{
$error = 1;
}
}
}
if($error === 0){
return TRUE;
}else{
return FALSE;
}
}
if(is_ipv6($_GET['h']) == TRUE){
}else{
echo "ip is ipv6 invalid";
}
?>