Ip Address

How can I get the users IP address in javascript/unityscript?

I am making my registration system log the address in the database when they register (to help prevent users from making dozens of accounts). How can I get this? Once I have it I can send the variable to the server to be added to the database table.

If you’re building a web player, you’ll have to pass such information to your game using a server side scripting language like php.

If you’re building a standalone game, you can access information about the user’s machine using the .Net libraries.

Found this:

function CheckIP(){
    myExtIPWWW = WWW("http://checkip.dyndns.org");
    if(myExtIPWWW==null) return;
    yield myExtIPWWW;
    myExtIP=myExtIPWWW.data;
    myExtIP=myExtIP.Substring(myExtIP.IndexOf(":")+1);
    myExtIP=myExtIP.Substring(0,myExtIP.IndexOf("<"));
    // print(myExtIP);
}