summaryrefslogtreecommitdiff
path: root/linkshorter
diff options
context:
space:
mode:
authorroot2014-11-17 01:42:48 +0100
committerroot2014-11-17 01:42:48 +0100
commitf7755964e8703d66cee123a18519a07d49df0ae0 (patch)
treed86a933802e200cf5d4e487afbd9d8bb121f5146 /linkshorter
parent4168f7aff52f6e7cf7320e42252227dac5169c4a (diff)
downloadtools.iamfabulous.de-f7755964e8703d66cee123a18519a07d49df0ae0.tar.gz
modified for use case
Diffstat (limited to 'linkshorter')
-rw-r--r--linkshorter/functions.php3
-rw-r--r--linkshorter/index.html50
-rw-r--r--linkshorter/index.php18
3 files changed, 14 insertions, 57 deletions
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>");
}