diff options
| author | root | 2014-11-27 03:09:22 +0100 |
|---|---|---|
| committer | root | 2014-11-27 03:09:22 +0100 |
| commit | 311ad398e06cd2eba270ea70ca5a326d03b490f9 (patch) | |
| tree | c409dafe5d0fa0b84c5f08e982b0596587725876 | |
| parent | 92babb43a2a0041a71b54db35cbc9d2fba908a63 (diff) | |
| download | tools.iamfabulous.de-311ad398e06cd2eba270ea70ca5a326d03b490f9.tar.gz | |
linkshorter now works with 2 domains
| -rw-r--r-- | linkshorter/index.php | 10 | ||||
| -rw-r--r-- | linkshorter/robots.txt | 2 | ||||
| -rw-r--r-- | linkshorter/view/templ-head.php | 1 | ||||
| -rw-r--r-- | linkshorter/view/templ-index.php | 2 | ||||
| -rw-r--r-- | linkshorter/view/templ-password.php | 2 | ||||
| -rw-r--r-- | tools/config.php | 3 | ||||
| -rw-r--r-- | tools/navbar.php | 9 |
7 files changed, 18 insertions, 11 deletions
diff --git a/linkshorter/index.php b/linkshorter/index.php index c60bc82..cca4f20 100644 --- a/linkshorter/index.php +++ b/linkshorter/index.php @@ -45,7 +45,7 @@ if ( ! isset($_REQUEST['checkpassword']) || $_REQUEST['checkpassword'] != 1 ) $options["ttl"] = ""; else { if ( ! preg_match( "/^[0-9]+$/", trim($_REQUEST["ttl"]) ) ){ - _do_output("Failure", "Your Lifetime doesn't look like a valid number."); + _do_output("Failure!", "Your Lifetime doesn't look like a valid number."); } $options["ttl"] = $_REQUEST["ttl"]; } @@ -58,20 +58,20 @@ if ( ! isset($_REQUEST['checkpassword']) || $_REQUEST['checkpassword'] != 1 ) $db = new Database(REDIS_CONNECT, REDIS_SELECT); if ( $options["short"] != "" && $db->exists($options["short"]) ) - _do_output("Failure", "Query string '".htmlentities($options["short"])."' already taken. Please choose a different one."); + _do_output("Failure!", "Query string '".htmlentities($options["short"])."' already taken. Please choose a different one."); if ( $options["short"] == "" ) $options["short"] = getToken(); if ( $options["ttl"] != "" ){ if ( ! $db->set($options["short"], json_encode($options), $options["ttl"]) ){ - _do_output("Failure", "Database went away. :("); + _do_output("Failure!", "Database went away. :("); } } else { if ( ! $db->set($options["short"], json_encode($options)) ){ - _do_output("Failure", "Database went away. :("); + _do_output("Failure!", "Database went away. :("); } } - _do_output("Success!", "Your shortlink is " . SHORTDOMAIN . htmlentities($options["short"]) . "."); + _do_output("Success!", "Your short link is " . SHORTDOMAIN . htmlentities($options["short"]) . "."); } diff --git a/linkshorter/robots.txt b/linkshorter/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/linkshorter/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/linkshorter/view/templ-head.php b/linkshorter/view/templ-head.php index abc29bf..2eee43c 100644 --- a/linkshorter/view/templ-head.php +++ b/linkshorter/view/templ-head.php @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title><?php echo $title; ?></title> <link rel="stylesheet" href="https://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"); ?> .grey { color: #737373;} diff --git a/linkshorter/view/templ-index.php b/linkshorter/view/templ-index.php index b78b5c7..17b042e 100644 --- a/linkshorter/view/templ-index.php +++ b/linkshorter/view/templ-index.php @@ -35,7 +35,7 @@ <div class="form-group"> <label class="col-md-4 control-label grey" for="ttl">(optional)</label> <div class="col-md-4"> - <input id="ttl" name="ttl" class="form-control input-md" type="number"> + <input id="ttl" name="ttl" class="form-control input-md" type="number" min="0"> <span class="help-block text-left">Choose how long the shortlink should be valid. (In seconds)</span> </div> </div> diff --git a/linkshorter/view/templ-password.php b/linkshorter/view/templ-password.php index 2be90f3..727ecd3 100644 --- a/linkshorter/view/templ-password.php +++ b/linkshorter/view/templ-password.php @@ -23,7 +23,7 @@ <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">Submit</button> </div> </div> diff --git a/tools/config.php b/tools/config.php new file mode 100644 index 0000000..d4b6071 --- /dev/null +++ b/tools/config.php @@ -0,0 +1,3 @@ +<?php + +define("__domain_", "http://tools.iamfabulous.de"); diff --git a/tools/navbar.php b/tools/navbar.php index 5546fc3..d0b9108 100644 --- a/tools/navbar.php +++ b/tools/navbar.php @@ -1,3 +1,4 @@ + <?php require dirname(__FILE__) . '/config.php'; ?> <nav class="navbar navbar-default navbar-custom" role="navigation"> <div class="container"> <div class="navbar-header"> @@ -5,18 +6,18 @@ <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> </button> - <a class="navbar-brand" href="/"><span class="glyphicon glyphicon-home"></span> Tools</a> + <a class="navbar-brand" href="<?php echo __domain_; ?>/"><span class="glyphicon glyphicon-home"></span> Tools</a> </div> <div class="collapse navbar-collapse" id="navbarCollapse"> <ul class="nav navbar-nav navbar-left"> <li id="linkshorter"> - <a href="/linkshorter/" title="Linkshorter"><span class="fa fa-link"></span> Linkshorter</a> + <a href="<?php echo __domain_; ?>/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> + <a href="<?php echo __domain_; ?>/header/" title="Check HTTP header online!"><span class="glyphicon glyphicon-globe"></span> Header</a> </li> <li id="ifconfig"> - <a href="/ifconfig/" title="Simple IP API"><span class="glyphicon glyphicon-transfer"></span> ifconfig</a> + <a href="<?php echo __domain_; ?>/ifconfig/" title="Simple IP API"><span class="glyphicon glyphicon-transfer"></span> ifconfig</a> </li> </ul> </div> |
