Jump to content

Dynamic IP address updater


Jujo
 Share

Recommended Posts

Today I made a simple program that updates IP address using AutoIt and PHP. PHP keeps track of IPs, and AutoIt submits it.

Note: You need hosting account with PHP support

Heres AutoIt code:

#Include <Constants.au3>
#Include <IE.au3>
#NoTrayIcon

HotKeySet("{ESC}", "die")
HotKeySet("{^F5}", "refresh")
$wait = InputBox("Updater", "Waiting time: ", "21600", "", "", "", "", "", 10)
$port = InputBox("Updater", "Port to submit: ", "1004", "", "", "", "", "", 10)

If $wait = 0 Or $wait = "" Then
    $wait = 21600
EndIf
If $port = 0 Or $port = "" Then
    $port = 1004
EndIf

$wait = $wait * 1000
refresh()
While 1
    Sleep($wait)
    refresh()
WEnd

Func refresh()
    $object = _IECreate("URL/update.php?port=" & $port, 0, 1)
    _IEQuit($object)
EndFunc
Func die()
    Exit
EndFunc

You have to change URL to some URL where is your update.php script located.

Here is update.php script source:

<?
$myFile = "data.txt";
$fh = fopen($myFile, 'w') or die("ERROR FILE 1");
$stringData = $_SERVER['REMOTE_ADDR'].':'.$_GET['port'];
fwrite($fh, $stringData);
fclose($fh);
?>

And, for reading, you just need to load data.txt file in your browser. Save this PHP file as update.php and create empty file called data.txt

I also recommend you to password protect the whole folder, but thats your choise ^_^

Edited by Jujo
Link to comment
Share on other sites

Today I made a simple program that updates IP address using AutoIt and PHP. PHP keeps track of IPs, and AutoIt submits it.

Note: You need hosting account with PHP support

Heres AutoIt code:

#Include <Constants.au3>
#Include <IE.au3>
#NoTrayIcon

HotKeySet("{ESC}", "die")
HotKeySet("{^F5}", "refresh")
$wait = InputBox("Updater", "Waiting time: ", "21600", "", "", "", "", "", 10)
$port = InputBox("Updater", "Port to submit: ", "1004", "", "", "", "", "", 10)

If $wait = 0 Or $wait = "" Then
    $wait = 21600
EndIf
If $port = 0 Or $port = "" Then
    $port = 1004
EndIf

$wait = $wait * 1000
refresh()
While 1
    Sleep($wait)
    refresh()
WEnd

Func refresh()
    $object = _IECreate("URL/update.php?port=" & $port, 0, 1)
    _IEQuit($object)
EndFunc
Func die()
    Exit
EndFunc

You have to change URL to some URL where is your update.php script located.

Here is update.php script source:

<?
$myFile = "data.txt";
$fh = fopen($myFile, 'w') or die("ERROR FILE 1");
$stringData = $_SERVER['REMOTE_ADDR'].':'.$_GET['port'];
fwrite($fh, $stringData);
fclose($fh);
?>

And, for reading, you just need to load data.txt file in your browser. Save this PHP file as update.php and create empty file called data.txt

I also recommend you to password protect the whole folder, but thats your choise :party:

Can I use this with DynDNS? I always wanted to have that updated for me :)
www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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