Skip to content

Latest commit

 

History

History

dyn.php

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

dyn.php

dyn.php is a tiny (< 250 LoC) CGI script written in PHP which provides a simple API to manage changes of dynamic IP addresses and which serves as a "What's my IP address?" tool as well.

Usage

Install the dyn.php to your web server and configure the configuration variables at the very top to your liking.

Important

Make sure to change PERSISTENCE_FILE and AUTH_PW_HASH!

Configuration

At the very top of the dyn.php script there are a handful of defines which serve as configuration options.

PERSISTENCE_FILE
the file which the script uses to store its data. This file should now be readable by the web server.
AUTH_USER
the user name used for authentication to ?out.
AUTH_PW_HASH
a PHP crypt()/password_hash() hashed form of the password used for authentication to ?out.
DATETIME_FORMAT
the output format for dates in strftime(3) format.
CONSIDER_FRESH_FOR
entries will be marked green if a system was added or its IP has changed in the last N seconds. Set to 0 to disable.
CONSIDER_OFFLINE_AFTER
entries will be marked red if a system did not ping dyn.php for this many seconds. Set to 0 to disable.

API

dyn.php has two "modes".

http://example.com/dyn.php[?name=][&quiet]

returns the current IP address in JSON format (unless ?quiet is used, in which case nothing will be returned).

If ?name is specified, the IP address will be remembered under this name and can be viewed later using ?out.

http://example.com/dyn.php?out

prints the IP addresses stored by previous ?name updates after authentication.