From 5b784858d36c5a35f3e17d2d3be0c5a8f0801474 Mon Sep 17 00:00:00 2001 From: trax Date: Sat, 15 Feb 2014 12:16:06 +0100 Subject: [PATCH 1/3] chmod 0700 db directory --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index d2e809b..0d2b09a 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,7 @@ if(!empty($_GET['url'])) { $hashfolderpath = './db/' . $hashfolder; $hashfilepath = $hashfolderpath . '/' . $hashfile; - mkdir($hashfolderpath, 0775, true); + mkdir($hashfolderpath, 0700, true); file_put_contents($hashfilepath, $url); echo './?'.$urlhash.'
'; From 2d9c7b7dd4cc6b2d2693005222a19fb8648e5796 Mon Sep 17 00:00:00 2001 From: trax Date: Sat, 15 Feb 2014 12:16:33 +0100 Subject: [PATCH 2/3] add form and html stuff --- index.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 0d2b09a..8c7b6ee 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,4 @@ ./?'.$urlhash.'
'; - echo 'As long as there is not collision you can shorten it up to 3 characters.'; - return 0; + $content = './?'.$urlhash.'
+ As long as there is not collision, you can shorten it down to 3 characters.'; } else if(!empty($_GET)) { $urlhash = key($_GET); @@ -33,21 +31,36 @@ if(!empty($_GET['url'])) { $findfiles = glob($hashfilepath . '*'); if(empty($findfiles)) { - echo 'No files.'; + $content .= 'No files.'; return 1; } else if (count($findfiles) > 1) { foreach($findfiles as $file) { $file = str_replace('/', '', substr($file, 5)); - echo './?'.$file.'
'; + $content .= './?'.$file.'
'; } - return 1; } $fullfilepath = current($findfiles); header('Location:' . file_get_contents($fullfilepath)); return 0; +} else { + $content = '
+ Enter your URL: +
'; } -echo './?url=<url>'; -return 0; +//actual page below +?> + + + + Shuri + + +
+ + +
+ + From 2254568e3324829b7652df11e4fae4a8f6f408ea Mon Sep 17 00:00:00 2001 From: trax Date: Sat, 15 Feb 2014 12:40:54 +0100 Subject: [PATCH 3/3] remove unecessary dots --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 8c7b6ee..07c9fdd 100644 --- a/index.php +++ b/index.php @@ -31,12 +31,12 @@ if(!empty($_GET['url'])) { $findfiles = glob($hashfilepath . '*'); if(empty($findfiles)) { - $content .= 'No files.'; + $content = 'No files.'; return 1; } else if (count($findfiles) > 1) { foreach($findfiles as $file) { $file = str_replace('/', '', substr($file, 5)); - $content .= './?'.$file.'
'; + $content = './?'.$file.'
'; } }