Commit e9d1ab5b52
Unsigned
Layout: unified · split
README.md +24 −11
| @@ -1,18 +1,31 @@ | |||
| 1 | ifconfig.php | 1 | ifconfig.php |
| 2 | ============ | 2 | ============ |
| 3 | 3 | ||
| 4 | **Simple PHP script to show IP-address, UserAgent and other info** | 4 | **Simple PHP script to show IP address, UserAgent and other info** |
| 5 | 5 | ||
| 6 | It works exactly the same as [ifconfig.me](http://ifconfig.me) and [ifconfig.co](http://ifconfig.co). | ||
| 6 | 7 | ||
| 7 | Added all basic features, such as output in HTML, plain text, XML and JSON. | 8 | Available all basic features such as output in HTML, plain text, XML and JSON. |
| 8 | By default it will be in HTML. Also it is possible to request single value. | 9 | By default it will be in HTML. Also it is possible to request single values. |
| 9 | 10 | ||
| 10 | Visit some of the links below to view it in action: | 11 | Visit some of the links below to view it in action: |
| 11 | * [all in plain text](http://briskin.org/ifconfig.php?q=text) | 12 | * [all in plain text](http://briskin.org/ifconfig/text) |
| 12 | * [all in xml](http://briskin.org/ifconfig.php?q=xml) | 13 | * [all in xml](http://briskin.org/ifconfig/xml) |
| 13 | * [useragent only](http://briskin.org/ifconfig.php?q=ua) | 14 | * [ip address only](http://briskin.org/ifconfig/ip) |
| 14 | 15 | * [useragent only](http://briskin.org/ifconfig/ua) | |
| 15 | P.s. | 16 | |
| 16 | I've made this script only as an illustration for my article about privacy problems. | 17 | |
| 17 | For now I have no plans to make it more powerfull, so I would like to recommend | 18 | |
| 18 | you another good project [ifconfig.co](http://ifconfig.co). | 19 | This is example of .htaccess rules, to make this script more user friendly: |
| 20 | |||
| 21 | RewriteEngine On | ||
| 22 | |||
| 23 | RewriteCond %{REQUEST_FILENAME} !-d | ||
| 24 | RewriteCond %{REQUEST_FILENAME} !-f | ||
| 25 | RewriteRule ^ifconfig$ ifconfig.php [L] | ||
| 26 | RewriteRule ^ifconfig/(.*)$ /ifconfig.php?q=$1 [L] | ||
| 27 | |||
| 28 | With this code in .htaccess file there is no need to type long line 'ifconfig.php?q='. | ||
| 29 | Now just enough to open 'ifconfig/xml' to get XML output or 'ifconfig/ua' to determine useragent. | ||
| 30 | |||
| 31 | Run `curl briskin.org/ifconfig/text` in Linux terminal to get some info. | ||
htaccess added +6
| @@ -0,0 +1,6 @@ | |||
| 1 | RewriteEngine On | ||
| 2 | |||
| 3 | RewriteCond %{REQUEST_FILENAME} !-d | ||
| 4 | RewriteCond %{REQUEST_FILENAME} !-f | ||
| 5 | RewriteRule ^ifconfig$ ifconfig.php [L] | ||
| 6 | RewriteRule ^ifconfig/(.*)$ /ifconfig.php?q=$1 [L] | ||