Jump to content
Jack

Add a simple IP check to your scripts

Recommended Posts

Some slightly cleaner code (I made my page display the ip without all of the rubbish). Might make it a millisecond or two faster :D.

//You need to be running java 7 I believe!
String ip; //where ip will be saved
try {
        BufferedReader in = new BufferedReader(new InputStreamReader(new URL("http://superscriptfactory.com/check.php").openStream()));
        ip = in.readLine();
        in.close();
}
catch (Exception e) {
        //Handle no ip found
}
  • Like 1
Link to comment
Share on other sites

 

Some slightly cleaner code (I made my page display the ip without all of the rubbish). Might make it a millisecond or two faster biggrin.png.

//You need to be running java 7 I believe!
String ip; //where ip will be saved
try {
        BufferedReader in = new BufferedReader(new InputStreamReader(new URL("http://superscriptfactory.com/check.php").openStream()));
        ip = in.readLine();
        in.close();
}
catch (Exception e) {
        //Handle no ip found
}

Yea I think my host must add random js to the bottom of my pages :(

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...