Commit b9d1984e6a
b9d1984e6a42b9a2966f925ff98f45b6dede0b31
parent: ed70cc4e7b
Verified · cmc
cmc <hello@cleberg.net> · 2026-08-31 22:20 UTC
Convert README.nfo to README.org
Layout: unified · split
.gitignore
+1 −2
| @@ -1,8 +1,7 @@ |
| 1 | # Composer installs these; composer.lock pins them. |
1 | # Composer installs these; composer.lock pins them. |
| 2 | vendor/ |
2 | vendor/ |
| 3 | |
3 | |
| 4 | # MaxMind GeoLite2. Licensed, ~69 MB, and stale the day after it is downloaded — |
4 | # MaxMind GeoLite2. Licensed, ~69 MB, and stale the day after it is downloaded. |
| 5 | # see README.nfo for how to fetch it. Never commit it. |
| |
| 6 | *.mmdb |
5 | *.mmdb |
| 7 | |
6 | |
| 8 | .DS_Store |
7 | .DS_Store |
README.nfo
deleted
−53
| @@ -1,53 +0,0 @@ |
| 1 | ┌──────────────────────────────────────────────────────────────┐ |
| |
| 2 | │ I F C O N F I G . P H P [ KRZ ] krz.sh │ |
| |
| 3 | └──────────────────────────────────────────────────────────────┘ |
| |
| 4 | |
| |
| 5 | WHAT |
| |
| 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 | |
| |
| 12 | USE |
| |
| 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 | |
| |
| 29 | DEVELOP |
| |
| 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 | └──────────────────────────────────────────────────────────────┘ |
| |
README.org
added
+61
| @@ -0,0 +1,61 @@ |
| |
1 | #+title: ifconfig.php |
| |
2 | |
| |
3 | * what |
| |
4 | php script. shows your ip address, user agent, and related info. |
| |
5 | same idea as ifconfig.me and ifconfig.co. |
| |
6 | |
| |
7 | output as html (default), plain text, xml, or json. single values |
| |
8 | on request. |
| |
9 | |
| |
10 | * use |
| |
11 | #+begin_example |
| |
12 | live at ip.cmc.pub: |
| |
13 | - ?q=text all, plain text |
| |
14 | - ?q=xml all, xml |
| |
15 | - ?q=ip ip only |
| |
16 | - ?q=ua user agent only |
| |
17 | #+end_example |
| |
18 | |
| |
19 | #+begin_src sh |
| |
20 | curl -L -X GET https://ip.cmc.pub/\?q\=text |
| |
21 | #+end_src |
| |
22 | |
| |
23 | apache rewrite so /ifconfig/xml works without the query string: |
| |
24 | |
| |
25 | #+begin_src sh |
| |
26 | RewriteEngine On |
| |
27 | RewriteCond %{REQUEST_FILENAME} !-d |
| |
28 | RewriteCond %{REQUEST_FILENAME} !-f |
| |
29 | RewriteRule ^ifconfig$ ifconfig.php [L] |
| |
30 | RewriteRule ^ifconfig/(.*)$ /ifconfig.php?q=$1 [L] |
| |
31 | #+end_src |
| |
32 | |
| |
33 | * develop |
| |
34 | install php and composer. fedora: |
| |
35 | |
| |
36 | #+begin_src sh |
| |
37 | sudo dnf install php-cli composer |
| |
38 | #+end_src |
| |
39 | |
| |
40 | maxmind-db dependency: |
| |
41 | |
| |
42 | #+begin_src sh |
| |
43 | composer require maxmind-db/reader:~1.0 |
| |
44 | composer update |
| |
45 | #+end_src |
| |
46 | |
| |
47 | geolite2 database. not in the repo: maxmind-licensed, ~69mb, and stale |
| |
48 | the day after you download it. sign up for a free maxmind account, then: |
| |
49 | |
| |
50 | #+begin_src sh |
| |
51 | https://www.maxmind.com/en/accounts/current/geoip/downloads |
| |
52 | #+end_src |
| |
53 | |
| |
54 | download GeoLite2-City in mmdb form and put GeoLite2-City.mmdb next to |
| |
55 | ifconfig.php. without it the page still serves, minus the geo block. |
| |
56 | |
| |
57 | dev server: |
| |
58 | |
| |
59 | #+begin_src sh |
| |
60 | sudo php --server localhost:8080 --docroot . |
| |
61 | #+end_src |