summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot2014-11-17 01:42:48 +0100
committerroot2014-11-17 01:42:48 +0100
commitf7755964e8703d66cee123a18519a07d49df0ae0 (patch)
treed86a933802e200cf5d4e487afbd9d8bb121f5146
parent4168f7aff52f6e7cf7320e42252227dac5169c4a (diff)
downloadtools.iamfabulous.de-f7755964e8703d66cee123a18519a07d49df0ae0.tar.gz
modified for use case
-rw-r--r--header/index.php18
-rw-r--r--index.php6
-rw-r--r--linkshorter/functions.php3
-rw-r--r--linkshorter/index.html50
-rw-r--r--linkshorter/index.php18
-rw-r--r--tools/footer.php18
-rw-r--r--tools/navbar.php7
-rw-r--r--tools/style.css8
8 files changed, 58 insertions, 70 deletions
diff --git a/header/index.php b/header/index.php
index 1a027ab..a41912a 100644
--- a/header/index.php
+++ b/header/index.php
@@ -38,7 +38,7 @@ if ( $set ){
$redis->ping();
$redis->select(9);
- $key = md5( $url . serialize($customHeader) );
+ $key = md5( $url . $method . serialize($customHeader) );
if( $redis->exists( $key ) ){
return unserialize( $redis->get( $key ) );
@@ -81,7 +81,7 @@ if ( $set ){
return $result;
}
- if ( ! isset($_REQUEST['method']) || $_REQUEST['method'] != "" ){
+ if ( ! isset($_REQUEST['method']) || $_REQUEST['method'] == "" ){
$_REQUEST['method'] = 'get';
} else {
$_REQUEST['method'] = strtolower($_REQUEST['method']);
@@ -112,13 +112,13 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
<?php
} else {
?>
- <h3>Retrieve HTTP Headers Online!</h3>
- <p>Check the response headers for websites. <br> Enter a URL and hit the submit button.</p>
- <br>
<form class="form-horizontal">
<fieldset>
-<legend></legend>
+<legend>
+ <h1>Retrieve HTTP Headers Online!</h1>
+ <p>Check the response headers for websites. </p>
+</legend>
<!-- Form Name -->
@@ -132,8 +132,9 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
<!-- Multiple Radios (inline) -->
<div class="form-group">
- <label class="col-md-4 control-label" for="method">Method</label>
+ <label class="col-md-4 control-label" for="method">Request method</label>
<div class="col-md-4">
+ <div class="text-left">
<label class="radio-inline" for="method-0">
<input name="method" id="method-0" value="GET" checked="checked" type="radio">
GET
@@ -146,6 +147,7 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
<input name="method" id="method-2" value="HEAD" type="radio">
HEAD
</label>
+ </div>
</div>
</div>
@@ -162,7 +164,7 @@ Host: "<u><?php echo strtolower(htmlentities($header_info[2])); ?></u>"</pre></h
<button type="button" class="btn btn-default addButton" title="Add more header." onclick="addInput('moreInput')"><i class="fa fa-plus"></i></button>
</span>
</div>
- <span class="help-block text-left">Add any header, which are sent to the server.</span>
+ <span class="help-block text-left">Add additional header, which are sent with the request.</span>
</div>
</div>
diff --git a/index.php b/index.php
index 99a8458..7996b07 100644
--- a/index.php
+++ b/index.php
@@ -5,7 +5,7 @@
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<style>
- <?php echo file_get_contents("../tools/style.css"); ?>
+ <?php echo file_get_contents("./tools/style.css"); ?>
</style>
<noscript><style>.navbar{margin-bottom:0;}</style></noscript>
<?php if ( ! $set) { ?>
@@ -18,7 +18,7 @@
<link rel='shortcut icon' href='../tools/favicon.ico' type='image/x-icon'>
</head>
<body>
- <?php require("../tools/navbar.php"); ?>
+ <?php require("./tools/navbar.php"); ?>
<div class="container">
<div class="text-center">
<div class="row">
@@ -27,4 +27,4 @@
</div>
</div>
- <?php require("../tools/footer.php"); ?>
+ <?php require("./tools/footer.php"); ?>
diff --git a/linkshorter/functions.php b/linkshorter/functions.php
index f6f021a..7fa8cff 100644
--- a/linkshorter/functions.php
+++ b/linkshorter/functions.php
@@ -13,11 +13,12 @@ function do_output($reason, $httpcode, $ajax = true, $heading = NULL){
<head>
<meta charset="utf-8">
<title>Link Shorter</title>
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!--style>html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%}#copyright-text{text-decoration:underline;color:#333}</style-->
<style>
<?php echo file_get_contents("../tools/style.css"); ?>
</style>
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <noscript><style>.navbar{margin-bottom:0;}</style></noscript>
<link rel='shortcut icon' href='../tools/favicon.ico' type='image/x-icon'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
diff --git a/linkshorter/index.html b/linkshorter/index.html
deleted file mode 100644
index 62ff295..0000000
--- a/linkshorter/index.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset=utf-8>
-<title>Link Shorter</title>
-<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
-<link rel=stylesheet href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
-<style>html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%}#copyright-text{text-decoration:underline;color:#333}</style>
-<meta name=viewport content="width=device-width, initial-scale=1.0">
-</head>
-<nav class="navbar navbar-default navbar-custom" role=navigation>
-<div class=container>
-<div class=navbar-header>
-<button type=button class=navbar-toggle data-toggle=collapse data-target="#navbarCollapse">
-<span class=sr-only>Toggle navigation</span>
-<span class=icon-bar></span>
-</button>
-<a class=navbar-brand href="">Home</a>
-</div>
-</div>
-</nav>
-<div class=container>
-<div class=text-center>
-<div class="row center-block vertical-center">
-<form class="form-horizontal " method=POST action=insert>
-<fieldset>
-<legend class=text-centered><h1>Amazing Linkshorter</h1></legend>
-<div class=form-group>
-<label class="col-md-4 control-label" for=url>Link:</label>
-<div class=col-md-5>
-<input id=url name=url placeholder="http://www.moehm.org/" class="form-control input-md" required>
-</div>
-</div>
-<div class=form-group>
-<label class="col-md-4 control-label" for=singlebutton></label>
-<div class=col-md-4>
-<button id=singlebutton name=singlebutton class="btn btn-info" type=submit>Short!</button>
-</div>
-</div>
-</fieldset>
-</form>
-</div>
-</div>
-</div>
-<div class="footer text-right">
-<div class=container>
-<p> Copyright 2014 <a id=copyright-text href="//www.moehm.org/" target=_blank>Maximilian M&ouml;hring</a></p>
-</div>
-</div>
-</body>
diff --git a/linkshorter/index.php b/linkshorter/index.php
index 75ac9aa..1d56be5 100644
--- a/linkshorter/index.php
+++ b/linkshorter/index.php
@@ -2,10 +2,12 @@
require 'functions.php';
require 'db.php';
-ob_start("sanitize_output");
+//ob_start("sanitize_output");
+ob_start();
if ( $_SERVER['REQUEST_METHOD'] != 'POST'){
+/*
$key = "lscache_" . md5( strtolower($_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"].$_SERVER["QUERY_STRING"]));
if ( $db->exists($key) ) {
header("X-Cache: Hit");
@@ -13,6 +15,7 @@ if ( $_SERVER['REQUEST_METHOD'] != 'POST'){
ob_end_flush();
exit;
}
+*/
?>
<!doctype html>
@@ -20,11 +23,12 @@ if ( $_SERVER['REQUEST_METHOD'] != 'POST'){
<head>
<meta charset="utf-8">
<title>Link Shorter</title>
- <!--style>html{position:relative;min-height:100%}body{margin-bottom:60px}.footer{position:absolute;bottom:0;width:100%}#copyright-text{text-decoration:underline;color:#333}</style-->
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<style>
<?php echo file_get_contents("../tools/style.css"); ?>
</style>
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
+ <noscript><style>.navbar{margin-bottom:0;}</style></noscript>
<link rel='shortcut icon' href='../tools/favicon.ico' type='image/x-icon'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
@@ -35,7 +39,9 @@ if ( $_SERVER['REQUEST_METHOD'] != 'POST'){
<form class="form-horizontal " method="POST">
<fieldset>
- <legend class="text-centered"><h1>Amazing Linkshorter</h1></legend>
+ <legend class="text-centered"><h1>Amazing Linkshorter</h1>
+ <p>Short your link and use a easy to remembery query string</p>
+ </legend>
<div class="form-group">
<label class="col-md-4 control-label" for="url">Link:</label>
@@ -56,7 +62,7 @@ if ( $_SERVER['REQUEST_METHOD'] != 'POST'){
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
- <button id="singlebutton" name="singlebutton" class="btn btn-info" type="submit">Short!</button>
+ <button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Short!</button>
</div>
</div>
@@ -104,5 +110,5 @@ if ( $_SERVER['REQUEST_METHOD'] != 'POST'){
}
$db->set($short, $_POST["url"]);
- do_output("<p>Your short link for <a href=\"".htmlentities($_POST["url"])."\">".htmlentities($_POST["url"])."</a> is <br> http://".$_SERVER["HTTP_HOST"]."/".$short."</p>", "200 OK", false, "<h1>Success</h1>");
+ do_output("<p>Your short link for <a href=\"".htmlentities($_POST["url"])."\">".htmlentities($_POST["url"])."</a> is <br> http://s.moehm.org/".$short."</p>", "200 OK", false, "<h1>Success</h1>");
}
diff --git a/tools/footer.php b/tools/footer.php
index 9bc6c55..fedea9f 100644
--- a/tools/footer.php
+++ b/tools/footer.php
@@ -7,3 +7,21 @@
</div>
</div>
</div>
+ <script>
+ function addClass(id,new_class){
+ if (id == "") return;
+ var i,n=0;
+
+ new_class=new_class.split(",");
+
+ for(i=0;i<new_class.length;i++){
+ if((" "+document.getElementById(id).className+" ").indexOf(" "+new_class[i]+" ")==-1){
+ document.getElementById(id).className+=" "+new_class[i];
+ n++;
+ }
+ }
+
+ return n;
+ }
+ addClass("<?php echo trim(str_replace("/index.php", "", $_SERVER["PHP_SELF"] ), "/");?>", "active");
+ </script>
diff --git a/tools/navbar.php b/tools/navbar.php
index b676fa2..1efa262 100644
--- a/tools/navbar.php
+++ b/tools/navbar.php
@@ -9,8 +9,11 @@
</div>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="nav navbar-nav navbar-left">
- <li>
- <a href="/header/" title="Check HTTP header online!" id="httpheader"> Header</a>
+ <li id="linkshorter">
+ <a href="/linkshorter/" title="Linkshorter"><span class="fa fa-link"></span> Linkshorter</a>
+ </li>
+ <li id="header">
+ <a href="/header/" title="Check HTTP header online!"><span class="glyphicon glyphicon-globe"></span> Header</a>
</li>
</ul>
</div>
diff --git a/tools/style.css b/tools/style.css
index c42a75b..02249d3 100644
--- a/tools/style.css
+++ b/tools/style.css
@@ -31,6 +31,10 @@ a {
color: white;
}
+.noscript {
+ background-color: #dd5148;
+ color: white;
+}
/* footer */
@@ -52,3 +56,7 @@ a {
color: white;
text-decoration: underline;
}
+
+.underline {
+ text-decoration: underline;
+}