diff --git a/config.example.php b/config.example.php
deleted file mode 100644
index 7ea51cb..0000000
--- a/config.example.php
+++ /dev/null
@@ -1,7 +0,0 @@
- $entry) {
+ $sort_keys[$key2] = $entry[$key];
+ }
+
+
+ return array_multisort($sort_keys, $order, $array);
+}
+
+if (is_readable(DATA_FILE)) {
$data = unserialize(gzinflate(file_get_contents(DATA_FILE)));
}
-else
+else {
$data = array();
+}
-// If we don't have exactly one $_GET arg, we print a default page
-if (count($_GET) != 1) {
- if (!empty($_POST['url']) || (isset($_GET['add']) && !empty($_GET['url']))) {
+// If we have exactly one GET arg, we redirect user
+if (count($_GET) == 1) {
+ // We get the shortened url
+ $get = each($_GET);
+ $short = $get['key'];
+ $url = BASE_URL;
+ if (array_key_exists($short, $data)) {
+ $url = $data[$short]['url'];
+ }
+ // $url is now index.php if no element was found, the right url if found
+ header('location:'.$url);
+ exit();
+}
+?>
+
+
+
+
+ Shorten me
+
+
+
+
+$url, "short"=>$short);
+
+ if (count($data) >= MAX_SAVED_URLS)
+ {
+ // Delete the first element
+ sort_array($data, 'timestamp');
+ array_shift($data);
+ }
+
+ // Store short link in the data array
+ $data[$short] = array('timestamp'=>time(), 'url'=>$url);
+
+ // Save it in the file
+ file_put_contents(DATA_FILE, gzdeflate(serialize($data)));
+
+ // Echoes the result
+ $new_url = BASE_URL.'/?'.$short;
+?>
+ Your shorten URL:
+
+
+ Short link for: '.$url.''; ?>
+
-
-
-
-
- Shorten me
-
-
-
-
-
-
-
+
+
+
diff --git a/process.php b/process.php
deleted file mode 100644
index 4ff13c3..0000000
--- a/process.php
+++ /dev/null
@@ -1,84 +0,0 @@
- $entry) {
- $sort_keys[$key2] = $entry[$key];
- }
-
-
- return array_multisort($sort_keys, $order, $array);
-}
-
-if(empty($_POST['url'])) {
- header('location : index.php');
-}
-else {
- if (is_readable(DATA_FILE)) {
- $data = unserialize(gzinflate(file_get_contents(DATA_FILE)));
- }
- else {
- $data = array();
- }
-}
-?>
-
-
-
-
- Shorten me !
-
-
-
-
-$url, "short"=>$short);
-
- if (count($data) >= MAX_SAVED_URLS)
- {
- // Delete the first element
- sort_array($data, 'timestamp');
- array_shift($data);
- }
-
- // Store short link in the data array
- $data[$short] = array('timestamp'=>time(), 'url'=>$url);
-
- // Save it in the file
- file_put_contents(DATA_FILE, gzdeflate(serialize($data)));
-
- // Echoes the result
- $new_url = BASE_URL.'/?'.$short;
-?>
- Your shorten URL:
-
-
- Short link for: '.$url.''; ?>
-Missing URL. Back to index page.";
-}
-?>
-
-