Remove foreach loop and fix multiple id vulnerability

I found that right after committing the last commit, the last id
entered would be the one finally redirected to. This also slowed
page load time. By grabbing only the very first key of $_GET and
throwing away the rest, the script will only look at the first
string after the '?'

Need to change links to reflect these changes (or it will try to
redirect to 'l' everytime instead of the id)