More security for profile.php

Bug reported by CopyCatHS