472,805 Members | 1,040 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

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 3776
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.