Thanks for the kudos.
If we need to pass special variables to login.php, we would need to do it in the same way by adding ?custom=yes or something like that.
I am not sure if this will work in your version, but it does in mine. I updated my test page linked above.
Code:
{if $login eq ''}
If you have an account Please <a href="http://trainingpen.com/login.php" title="Sign in" onclick="javascript: return !popupOpen('login.php');">Sign in</a>!
Or you have to register. Go here: <a href="register.php?custom=yes">Register</a>
{else}
You are registered and logged in! Congratulations!
{/if}