Thankyou both, there is error checking for the ip, check the $longip statement, but sometimes $address, doesn't work.i suggest using this script in the whois. im not sure why address doesn't always work tbh, i think it's because the user has to join for mirc to register their address, but ive never looked into it.
i will update when im back on my normal computer im having to use a netbook atm with linux on it and i cba to install mirc on wine or a VirtualBox yet.