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