$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 { $data = array(); } // 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

It's too long…

$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.''; ?>

Add this link to your bookmarks to shorten links in one click ! Short link