diff --git a/index.php b/index.php
index 07c9fdd..b5ea46b 100644
--- a/index.php
+++ b/index.php
@@ -1,51 +1,53 @@
./?'.$urlhash.'
+ file_put_contents($hashfilepath, $url);
+ $content = './?'.$urlhash.'
As long as there is not collision, you can shorten it down to 3 characters.';
-} else if(!empty($_GET)) {
- $urlhash = key($_GET);
+} elseif (!empty($_GET)) {
+ $urlhash = key($_GET);
- $hashfolder = substr($urlhash, 0, 2);
- $hashfile = substr($urlhash, 2);
+ $hashfolder = substr($urlhash, 0, 2);
+ $hashfile = substr($urlhash, 2);
- $hashfolderpath = './db/' . $hashfolder;
- $hashfilepath = $hashfolderpath . '/' . $hashfile;
+ $hashfolderpath = './db/'.$hashfolder;
+ $hashfilepath = $hashfolderpath.'/'.$hashfile;
- $findfiles = glob($hashfilepath . '*');
+ $findfiles = glob($hashfilepath.'*');
- if(empty($findfiles)) {
- $content = 'No files.';
- return 1;
- } else if (count($findfiles) > 1) {
- foreach($findfiles as $file) {
- $file = str_replace('/', '', substr($file, 5));
- $content = './?'.$file.'
';
- }
- }
+ if (empty($findfiles)) {
+ $content = 'No files.';
- $fullfilepath = current($findfiles);
+ return 1;
+ } elseif (count($findfiles) > 1) {
+ foreach ($findfiles as $file) {
+ $file = str_replace('/', '', substr($file, 5));
+ $content = './?'.$file.'
';
+ }
+ }
- header('Location:' . file_get_contents($fullfilepath));
- return 0;
+ $fullfilepath = current($findfiles);
+
+ header('Location:'.file_get_contents($fullfilepath));
+
+ return 0;
} else {
- $content = '