- Home /
Question by
brandon199511 · Jan 20, 2012 at 06:17 PM ·
networkingaddressip
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.
Comment
Answer by jahroy · Jan 20, 2012 at 06:55 PM
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.
Answer by brandon199511 · Jan 20, 2012 at 06:56 PM
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);
}