Open a new url in main window with PHP

This is a discussion on Open a new url in main window with PHP within the PHP Language forums, part of the PHP Programming Forums category; I'm looking for a way in PHP to reroute the main window. If during the build of a page ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-25-2005
Henk
 
Posts: n/a
Default Open a new url in main window with PHP

I'm looking for a way in PHP to reroute the main window.
If during the build of a page in a child frame some conditions are not met,
I would like to reload a login page in the main window, and not in the child
frame.

header("location: http:..........................");
When I use the above method the page is rerouted in the child frame. Is
there a method in clean PHP that can open this page in the main window, a
little bit like in javascript:

if (parent) parent.location.href = "login.php";

Note: using javascript on the client side is not an option I think.

Thanks a lot,
Henk


Reply With Quote
  #2 (permalink)  
Old 04-26-2005
NC
 
Posts: n/a
Default Re: Open a new url in main window with PHP

Henk wrote:
>
> I'm looking for a way in PHP to reroute the main window.
> If during the build of a page in a child frame some conditions
> are not met, I would like to reload a login page in the main
> window, and not in the child frame.

....
> Note: using javascript on the client side is not an option I think.


Your best bet is to move processing of conditions out of frames
into the frameset. The frameset should check the conditions and
then, depending on the outcome, either redurect to the login page
or render the frameset.

Failing that, you can still process in frames, but display an
error message in a way that would ensure proper redirection.
For example:

echo <<<MSG
<p>Authorization failed. <br>
Click <b>OK</b> to return to the login page. </p>
<form action="login.php" target=_top>
<input type="submit" value="OK">
</form>
MSG;

Cheers,
NC

Reply With Quote
  #3 (permalink)  
Old 04-26-2005
micha
 
Posts: n/a
Default Re: Open a new url in main window with PHP


NC wrote:
> Henk wrote:
> >
> > I'm looking for a way in PHP to reroute the main window.
> > If during the build of a page in a child frame some conditions
> > are not met, I would like to reload a login page in the main
> > window, and not in the child frame.

> ...
> > Note: using javascript on the client side is not an option I think.

>
> Your best bet is to move processing of conditions out of frames
> into the frameset. The frameset should check the conditions and
> then, depending on the outcome, either redurect to the login page
> or render the frameset.
>
> Failing that, you can still process in frames, but display an
> error message in a way that would ensure proper redirection.
> For example:
>
> echo <<<MSG
> <p>Authorization failed. <br>
> Click <b>OK</b> to return to the login page. </p>
> <form action="login.php" target=_top>
> <input type="submit" value="OK">
> </form>
> MSG;
>
> Cheers,
> NC



yes, to make that clear: php runs server side, so it has no way of
knowing (and accessing) frames in the browser.

micha

Reply With Quote
  #4 (permalink)  
Old 04-26-2005
Henk
 
Posts: n/a
Default Re: Open a new url in main window with PHP

Yes, your last example could be I nice solution.

I need this when a user is logged out and then uses the back button or the
links in the history list again. I noticed the no-cache code in the PHP
tutorial is sometimes not working, for example when users are given less
rights in the browser's settings by the system administrator.
When the server then notices an unauthorized user is requesting for a page,
it would indeed be appropriate to send this user a clear message that he is
not authorized, instead of a silent redirect to the login page.

Thanks,
Henk


"NC" <nc@iname.com> schreef in bericht
news:1114473261.666802.317690@z14g2000cwz.googlegr oups.com...
> Henk wrote:
>>
>> I'm looking for a way in PHP to reroute the main window.
>> If during the build of a page in a child frame some conditions
>> are not met, I would like to reload a login page in the main
>> window, and not in the child frame.

> ...
>> Note: using javascript on the client side is not an option I think.

>
> Your best bet is to move processing of conditions out of frames
> into the frameset. The frameset should check the conditions and
> then, depending on the outcome, either redurect to the login page
> or render the frameset.
>
> Failing that, you can still process in frames, but display an
> error message in a way that would ensure proper redirection.
> For example:
>
> echo <<<MSG
> <p>Authorization failed. <br>
> Click <b>OK</b> to return to the login page. </p>
> <form action="login.php" target=_top>
> <input type="submit" value="OK">
> </form>
> MSG;
>
> Cheers,
> NC
>



Reply With Quote
  #5 (permalink)  
Old 04-27-2005
hackajar@gmail.com
 
Posts: n/a
Default Re: Open a new url in main window with PHP

This type of request usually is for annoying pop-up banners. If this
REALLY is for login, use something like this:

if (!session_is_registered('count')) require_once('login.php');

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:22 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0