phpchick Posted May 6, 2011 Share Posted May 6, 2011 I have a program that is loaded into an iframe, more specifically the fancybox modal window app. It is the one here http://www.phpfreaks.com/forums/index.php?topic=332297.0 which dragonSA and others so graciously helped me with. On completion of the program (no errors), I want it to redirect the entire page to a new one. (the user successfully logs in) The problem it seems is that my header('URL'); redirects to the page, but within the iframe. I want the top frame to redirect, and obviously closing the modal window. I did some research and it seems that frames are client-side while PHP is getting processed server-side so it's unable to target another frame. I believe that this makes it out of PHP's scope to do this, but I am not sure. I did some more research and a lot of people on the web are using javascript to do this, but none of the examples showed how it could be implemented in something like mine (after a true if statement inside the php script). // the following code is inside a <?php ?> statement if (count($aError) == 0) { header( 'Location: http://www.site.com/welcome.html' ) ; } Quote Link to comment https://forums.phpfreaks.com/topic/235715-redirecting-to-a-page-on-the-top-frame-with-php/ Share on other sites More sharing options...
phpchick Posted May 6, 2011 Author Share Posted May 6, 2011 I got it working, all I did was paste this code where I wanted the redirect instead of the header I had earlier. if(!isset($_SESSION['SESS_USERID'])||(trim($_SESSION['SESS_USERID']=='admin'))) { echo '<script language="javascript">'; echo 'top.location.href = "../accessDenied.php";'; echo '</script>'; exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/235715-redirecting-to-a-page-on-the-top-frame-with-php/#findComment-1211556 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.