basic layout finished

This commit is contained in:
Kristjan Komlosi
2020-07-01 15:49:57 +02:00
parent 7b3f290bf4
commit c8f37c00e7
8 changed files with 76 additions and 21 deletions

11
.htaccess Normal file
View File

@@ -0,0 +1,11 @@
SetEnvIf X-Forwarded-Proto https HTTPS
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
# END WordPress
Options FollowSymLinks
RewriteEngine On
RewriteRule ^/ipinfo$ /ipinfo/index.php [L]

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# ipinfo-lite
ipinfo-lite is a tiny IP information site written in PHP as my first PHP project.
Visiting an ipinfo-lite instance provides you with your IP address, its DNS hostname and the user agent string.
It's also compatible with console tools, supporting cURL and GNU Wget.
The goal of this tool is to be fast and dead-simple. Design is adapted from the
[better moterfucking website](http://bettermotherfuckingwebsite.com/).
It is free software, available under ISC License.
# Usage
Extract all but this readme file into a directory on your webserver. The webapp is then available from it's directory name.

View File

@@ -1,10 +0,0 @@
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'curl') !== FALSE
|| strpos($_SERVER['HTTP_USER_AGENT'], 'wget') !== FALSE)
{
echo "$_SERVER[REMOTE_ADDR]";
}
else
{
include 'ifconfig.php';
}

View File

@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> ifconfig.si - test </title>
</head>
<body>
<h1>ifconfig.si<h1>
<h1><?php echo "$_SERVER[REMOTE_ADDR]" ?></h1>
</body>
</html>

11
index.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'curl') !== FALSE ||
strpos($_SERVER['HTTP_USER_AGENT'], 'Wget') !== FALSE)
{
include 'ipinfo-console.php';
}
else
{
include 'ipinfo-pretty.php';
}
?>

17
ipinfo-pretty.css Normal file
View File

@@ -0,0 +1,17 @@
body {
margin: 40px auto;
max-width: 65vw;
line-height: 1.6;
font-size: 18px;
color: #444;
padding: 0 10px
}
h1,h2,h3 {
line-height: 1.2;
}
td:first-child {
font-weight: bold;
padding-right: 3em;
}

25
ipinfo-pretty.php Normal file
View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo "$_SERVER[HTTP_HOST]"; ?></title>
<link rel="stylesheet" href="ipinfo-pretty.css"/>
</head>
<body>
<h1><?php echo "$_SERVER[HTTP_HOST]"; ?> - IP info</h1>
<table>
<tr>
<td>Your IP:</td><td><?php echo "$_SERVER[REMOTE_ADDR]"; ?></td>
</tr>
<tr>
<td>Your hostname:</td><td><?php echo gethostbyaddr($_SERVER['REMOTE_ADDR']);?></td>
</tr>
<tr>
<td>Your user agent:</td><td><?php echo "$_SERVER[HTTP_USER_AGENT]"; ?></td>
</tr>
</table>
<footer>
This site runs <a href="https://github.com/cls-02/ipinfo-lite">ipinfo-lite</a> - a tiny IP info webapp
</footer>
</body>
</html>