This is an online code that does not require a database. The URL to be shortened is stored in a txt file in the same directory. Demonstration: http://www.ucmbaa.org/u/ The first purpose is to shorten the URL, and the second is to prevent search engines from recognizing this address.
/*
location of file to store URLS
*/
$file = 'urls.txt';
/*
use mod_rewrite: 0 - no or 1 - yes
*/
$use_rewrite = 1;
/*
language/style/output variables
*/
$l_url = 'URL';
$l_nourl = 'No URL address entered strong>';
$l_yoururl = 'Your short URL:';
$l_invalidurl = 'Invalid URL.';
$l_createurl = ' Generate short URL';
////////////////////// NO NEED TO EDIT BELOW /////////////////// //
if(!is_writable($file) || !is_readable($file))
{
die('Cannot write or read from file. Please CHMOD the url file (urls.txt) by default to 777 and make sure it is uploaded.');