PDA

View Full Version : lolz.url [A short URL service]



timROGERS
10-03-2007, 01:58 PM
I've spent an hour or two building a MySQL based Short URL service. When I was new to PHP, I made a really bad one, that made a directory with an index.php file in it. The problem with this was that it made bad permissions so I couldn't delete what I'd done :P

So, this morning I decided I'd made a quick version. It's easy to use, and requires four file edits to customise it to any server. Firstly, you need to edit the config.inc.php file, adding your MySQL details (it makes the table itself when you run install.php). Then you need to replace the HTML and links in add.php and go.php with your own HTML and links, and then finally you need to edit the .htaccess file so that it will go to the right place. Then to make it work, you just make an index file with a form. Make a text field called "url" and set the form action to add.php! That's it! It creates nice URLs, such as http://url.lolz.co.uk/1234

Demo: http://url.lolz.co.uk/
Download: http://url.lolz.co.uk/89743

Blob
10-03-2007, 02:00 PM
Well done!

ZAG
10-03-2007, 02:04 PM
It doesnt check to see if ive actually put a URL in

timROGERS
10-03-2007, 02:05 PM
It doesnt check to see if ive actually put a URL in

Oops, I didn't think about that xD

Luckyrare
10-03-2007, 10:28 PM
Nice one Tim. Maybe you could check up to see if that URL has been shortend before and if so return with its old short url saving on mysql space.

Mr.OSH
11-03-2007, 02:08 AM
Well done, its a great piece of clever thinking and a nice script. + rep. :)

phpme
16-04-2007, 04:00 AM
Good one i'll be using it ++rep

:Edzy
16-04-2007, 08:13 AM
wont work pour moi

k it duz but u cant put www. ;P

Sygon..
17-04-2007, 12:24 PM
You can put invalid urls in it, it doesnt check if they are valid.

additional
17-04-2007, 03:23 PM
Nice one +rep. I've seen a script around when it does it automatically.

nets
18-04-2007, 09:14 PM
Your script has a slight vulnerability if the client's configuration enables 'register globals'. Malicious users can craft the page's header to fit their needs.

Replace:
$header .= "Location: "; /* Sets header */
With:
$header = "Location: "; /* Sets header */

Want to hide these adverts? Register an account for free!