473,473 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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
Jul 17 '05 #1
4 3784
NC
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

Jul 17 '05 #2

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

Jul 17 '05 #3
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:11**********************@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

Jul 17 '05 #4
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');

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ck388 | last post by:
I am trying to open a frameset in a new window......where the frame called "main" shows the file called customerGeneral.aspx. I can't get it to work though...i always get something like...
4
by: Dan Cruz | last post by:
Below are two files: Main.asp and Help.asp. I've stripped it down to the 'barest-of bones' so that anyone willing to help can duplicate the problem on their own systems. ***Main.asp*** looks...
2
by: Samir Pandey | last post by:
Hello, I am using the following javascript code to open a new window. Somehow, IE always opens a new window. It doesn't open target url in the window name given. All i want is, if there is a...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
2
by: David | last post by:
I have a main web form, "main.aspx" with one login-button. I'd like to open a 2nd form "frm_activity.aspx" in a separate browser window using a client-script upon clicking the login-button from main...
6
by: Shamin | last post by:
Hi, Thanks in advance for answering to my Question. I'm stuck with this problem and would really appreciate any help. I have 2 aspx files (Main.aspx and ReportViewer.aspx). Main.aspx has a...
1
by: RJN | last post by:
Hi Sorry for posting again. I open a few pop-up windows from a main window. If session time out occurs in either the main window or the pop-up windows ,I redirect the user to login screen....
2
by: carlor | last post by:
Hi there, I have a form that contains a link button. When the user clicks the link button I need to enable a couple of other buttons on the page and open a new browser window giving it focus...
6
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is...
1
by: ipellew | last post by:
Hi; I open another browser window for help. It stays open untill I press help on my main web window again to close this help. If I "reload" the main window with this help page open in the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.