<?//Set these strings $servpath = "C:\Peter\Evolutions 0.7.3"; //Change this to your ot directory $configlua = file_get_contents($servpath."/config.lua"); //Dont change this unless you know what you are doing $mirror1 = 'http://www.whatismyip.com'; //If you change a mirror, then you have to change the way the script gets info from it so i suggest you don't $mirror2 = 'http://myip.dk'; //If you change a mirror, then you have to change the way the script gets info from it so i suggest you don't $mirror3 = 'http://youripis.org/'; //If you change a mirror, then you have to change the way the script gets info from it so i suggest you don't //Get ip address from whatismyip.com $openmirror1 = fopen($mirror1,'r'); $readmirror1 = fread($openmirror1,159); $steponemirror1 = explode(" - ",$readmirror1); $steptwomirror1 = explode("<",$steponemirror1[1]); $ip1 = $steptwomirror1[0]; fclose($openmirror1); echo("<br>$mirror1 says : " . $ip1 . "</br>"); //Get ip address from myip.dk $openmirror2 = fopen($mirror2,'r'); $readmirror2 = fread($openmirror2,110); $steponemirror2 = explode(" : ",$readmirror2); $steptwomirror2 = explode("<",$steponemirror2[1]); $ip2 = $steptwomirror1[0]; fclose($openmirror2); echo("<br>$mirror2 says : " . $ip2 . "</br>"); //Get ip address from whatismyip.org $openmirror3 = fopen($mirror3,'r'); $content = ""; while(!feof($openmirror3)){ $buffer = trim(fgets($openmirror3,4096)); $content .=$buffer; } $start = '<title>Your IP Is '; $end = '<\/title>'; preg_match("/$start(.*)$end/s",$content,$match); $ip3 = $match[1]; fclose($openmirror3); echo("<br>$mirror3 says : " . $ip3 . "</br>"); //Compare the ips if($ip1==$ip2 && $ip1==$ip3 && $ip1!="") { echo("<br>Ips match! Checking ip in config.lua...</br>"); } else { die("<br>Error matching ips! Please call your ISP to ask them what's wrong or comment in the forums.</br>"); } //Get ip address from config.lua $findconfigip = stristr($configlua,'ip = '); $parseconfigip = explode('"', $findconfigip); $configip = $parseconfigip[1]; echo("<br>Config.lua says : " . $configip . "</br>"); if($ip1==$configip) { die("<br>Your ip is up to date!</br>"); } else { echo("<br>Your ip has changed! Renewing ip...</br>"); $replacement = str_replace('ip = "'.$configip.'"', 'ip = "'.$ip1.'"', $configlua); $openconfig = fopen($servpath.'/config.lua', 'w'); fwrite($openconfig, $replacement); fclose($openconfig); echo("<br>Updated your new IP ($ip1) to config.lua</br>"); } ?>