Hi,
Just to make it a bit clearer (I hope) some additional info.
I just edited the code, it looks completely logical, but it doesn't work in my script! I just don't understand it.
I use a function to present the whois-output word-by-word:
- it splits the whois-text at the spaces and trims the spaces from the words.
- then it checks each word wether it is an IP-number, an e-mail or an internetadres: these are all presented as a link;
- the other words are 'normal' words and are presented as such.
The function works for all but the IP's!:evil:
The code for the function is as follows:
Code: Select all
<?php
function present($rawoutput,$thispage) {
// This function checks wether a word is an IP-number or not
// if so, it's presented as link to the whois-form
$rawwords = preg_split("/(?=\s)/",$rawoutput);
$wrong_ip = false;
foreach ($rawwords as $word) {
$word = trim($word);
echo "<br>$wrong_ip [".$word."]";
if(!eregi("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$", $word)) {
$wrong_ip = true;
}
if (!$wrong_ip) {
echo "<a class='text' href='$thispage?domain=$word'>".$word."</a> ";
} elseif (preg_match("/@/",$word)) {
echo "<a class='text' href='mailto:$word'>".$word."</a> ";
} elseif (preg_match("/^http:/",$word)) {
echo "<a class='text' target='new' href='$word'>".$word."</a> ";
} else {
echo $word." ";
}
}
}
?>
I've added the text
echo "<br>$wrong_ip [".$word."]"; just for debugging.
The result I get is:
Code: Select all
ї%]%
1 їїwhois.apnic.net]їwhois.apnic.net
1 їnode-1]]node-1]
1 ї]
ї%]%
1 їWhois]Whois
1 їdata]data
1 їcopyright]copyright
1 їterms]terms
1 ї]
1 ї]
1 ї]
1 їhttp://www.apnic.net/db/dbcopyright.html]http://www.apnic.net/db/dbcopyright.html
1 ї]
ї]
1 ї]
їinetnum:]inetnum:
1 ї]
1 ї]
1 ї]
1 ї]
1 ї]
1 ї211.21.0.0]211.21.0.0
1 ї-]-
1 ї211.21.255.255]211.21.255.255
1 ї]
etc.
It seems to me that the IP is of the correct format, but it still doesn't get detected!!
Can anybody find what I do wrong?? All ideas are welcome!!
Thanx
Ad