Not that I know of. But then, are you supposing that normal users will be around faking their Referer just to be redirected to the wrong place? That looks unlikely.
I worry about the need to redirect users to where they came from without even asking them about it. I'd either have a preferences option to decide to allow it or not (and where to), or ask them previously to the redirection, being able to deny the redirection.
If RoBorg's assumption that you'll be offering login screens on different sites than your own and you want to store the source site, then of course you can use the same form to send the site they logged on from.