Show if redirected to login page
So far I have set up a login page for a specific area of the site based on an access rule. I've also set it all up so that if someone returns to a page without logging in then they are redirected to the login page.
That's all working with no problems.
What I want to do is add a bit of text "You have to be logged in to view this page". Above the login form. But I only want it to show if they have got there from a redirect. I've tried this but it doesn't work and I'm at a bit of a loss.
Any help would be appreciated.
<?php
if ("$redirectURL" == "TRUE") { // WebAssist Show If
?>
<p>You need to be logged in to view this page.</p>
<?php
} // ("$redirectURL" == "TRUE")
?>