krz/ifconfig.php

clone: git clone https://gitbay.org/krz/ifconfig.php.git

main: README.nfo · raw

 1┌──────────────────────────────────────────────────────────────┐
 2│  I F C O N F I G . P H P                   [ KRZ ]   krz.sh  │
 3└──────────────────────────────────────────────────────────────┘
 4
 5WHAT
 6  php script. shows your ip address, user agent, and related info.
 7  same idea as ifconfig.me and ifconfig.co.
 8
 9  output as html (default), plain text, xml, or json. single values
10  on request.
11
12USE
13  live at ip.cmc.pub:
14  - ?q=text   all, plain text
15  - ?q=xml    all, xml
16  - ?q=ip     ip only
17  - ?q=ua     user agent only
18
19      curl -L -X GET https://ip.cmc.pub/\?q\=text
20
21  apache rewrite so /ifconfig/xml works without the query string:
22
23      RewriteEngine On
24      RewriteCond %{REQUEST_FILENAME} !-d
25      RewriteCond %{REQUEST_FILENAME} !-f
26      RewriteRule ^ifconfig$ ifconfig.php [L]
27      RewriteRule ^ifconfig/(.*)$ /ifconfig.php?q=$1 [L]
28
29DEVELOP
30  install php and composer. fedora:
31
32      sudo dnf install php-cli composer
33
34  maxmind-db dependency:
35
36      composer require maxmind-db/reader:~1.0
37      composer update
38
39  geolite2 database. not in the repo: maxmind-licensed, ~69mb, and stale
40  the day after you download it. sign up for a free maxmind account, then:
41
42      https://www.maxmind.com/en/accounts/current/geoip/downloads
43
44  download GeoLite2-City in mmdb form and put GeoLite2-City.mmdb next to
45  ifconfig.php. without it the page still serves, minus the geo block.
46
47  dev server:
48
49      sudo php --server localhost:8080 --docroot .
50
51┌──────────────────────────────────────────────────────────────┐
52│  krz.sh                                                      │
53└──────────────────────────────────────────────────────────────┘