As I read it, what you have is a main page where folks can log in and that's no problem.
But you have a seperate page, which sounds like a popup window, where folks can also login?
What you can do then, is when a user closes the seperate window, have a javascript in it's body tag.....
onunload="window.open('yourmainpage.php')"
and if it's a popup window, you can tell it to close the popup with a call to opener.window.close()
umm... I think that's what's needed?