CLOSE IFRAME AND REDIRECT USER TO USER_PAGE

OKKK! good day please i have little problem that is now a mighty one before me. I added a login form to a page using Iframe modal class i got from tinybox2. I have been able to login the user and in use the HEADER function to redirect the user to their user_page but the direction is done in the I-frame and not the parent window. Now my problem is how do i close the iframe and still redirect the user to the next page. I tried some javascript but all to no avail .
[font=verdana][size=18pt] THE LOGIN AND I-FRAME PAGE SCRIPT [/size][/font]

[php]

<?php if(empty($errors)=== true){ $login=login($username, $password); if($login === false){ $errors[]='INVALID LOGIN DETAILS.... PLEASE CHECK YOUR DETAILS AND TRY AGAIN.'; } else{ $_SESSION["user_id"]=$login; ?>
		<script> parent.window.close();</script>
		<?php
		header("location:user_page.php");
		}
		}
	if(empty($errors)=== false){
			$_SESSION["errors"]=$errors[0];
	}
	
}

?>

Login

Member Login

Please provide your details

Username
Password:
<?php if(isset($_SESSION["errors"])){?>

<?php echo $_SESSION["errors"]; unset($_SESSION["errors"]);?>

<?php }?>
[/php]

Are you getting any errors?

This is how I would go about doing it, but it might not be exactly what you want. To be honest I don’t use iframes all that much, so I don’t know exactly if this would work.

In my CSS would have a class that could be called iframe_close:

.iframe_close { display: none; } 

Then in your html having something like

[php]$iframe_close = ($_SESSION[“user_id”])? “iframe_close” : NULL;

[/php]

then you could redirect as normal, but like I said I don’t use iframe all that much (if I had it was for advertising).

Sponsor our Newsletter | Privacy Policy | Terms of Service