Improve a bit user input parameters, also make sure referer starts with / to avoid sending users to external sites