Solved

PHP header(Location: somes_cript.php; target: frame_name) does not work

Posted on 2013-12-30
7
3,966 Views
Last Modified: 2013-12-30
I have a frameset page of the following code in a page called index.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
<HEAD>
</HEAD>
<FRAMESET cols="10%, 90%">
  <FRAMESET rows="10%, "90%">
      <FRAME name="status" id="status" src="status.php" scrolling="no" noresize="noresize" frameborder="0" target="status" >
      <FRAME  name="menu" id="menu" src="menu.php"  scrolling="no" noresize="noresize" frameborder="0" target="menu" >
  </FRAMESET>
  <FRAMESET rows="20%, "80%">
      <FRAME name="header" id="header" src="header.php"  scrolling="no" noresize="noresize" frameborder="0" target="header">
      <FRAME  name="main" id="main" src="login.php"  scrolling="yes" noresize="noresize" frameborder="0" traget="main">
  </FRAMESET>
  <NOFRAMES>
      Sorry, your browser does not handle frames!
  </NOFRAMES>
</FRAMESET>
</HTML>

Open in new window



I want via an php script on the server running in the frame of target=main to let the rest of the framea to reload, I have read that this can be done using the header command, but I tried the following format but none is working:
 <?php
   session_start();
   header('Window-target: header');
   header('Location: header.php');
   header('Window-target: status');
   header('Location: status.php');
?>

Open in new window



And :

 <?php
   session_start();
   header('Location: header.php; Window-target: header');
   header('Location: status.php; Window-target: status');
?>

Open in new window


And I tried as well (Where here I used the location name is the php script where the frames are defined):
<?php
   session_start();
   header('Location: index.php; target: header');
   header('Location: index.php; target: status');
?>

Open in new window




But I am always getting these errors:
The requested URL /status.php; target: status was not found on this server.
The requested URL /index.php; target: status was not found on this server.
Can someone guide me how to force the other frames to reload?
0
Comment
Question by:Ashraf Hassanein
7 Comments
 
LVL 5

Assisted Solution

by:DamjanDemsar
DamjanDemsar earned 150 total points
ID: 39745817
Hmm, you cannot work outside the frame using PHP.

You can using javascript something like:

<script type="text/javascript">
parent.location.reload();
</script>

Open in new window

0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39745845
Can you please step away from the technical details here and just tell us in plain language what you want to do?  Or show us a link to a site design that you want to emulate.  There are probably well-understood design patterns and if we can see the bigger picture we might be able to help you find a good design.
0
 

Author Comment

by:Ashraf Hassanein
ID: 39746334
Hi John,
     My website first page is a frame based where it has 4 frames
     1-Frame header where it have only the logo (At the begining when the user did not login yet).
     2- Frame Status where it is blank (At the begining when the user did not login yet).
     3- Frame menu where it is blank  (At the begining when the user did not login yet).
     4- Frame main where it has the login page

      When you login:
      1-The header frame has to be reloaded to show a toolbar.
      2- The status frame has to be reloaded to show the username, client IP, and his privileges
      3- The menu frame has to show the menu, and depending on the subscriber priviliges he will have different menu.
      4- The main frame will show the site content itself.


     For the moment I have have just created the php pages forthe header frame to show the toolbar and the status, once they are reloaded, and I am stuck here.
     My web site is:  https://www.hassans.nl
                              username/password: Guest123/Guest123
    Can you help me in that please?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 150 total points
ID: 39746368
I can give a general idea about how one might design such an application.  First, you should read this article carefully.  It will show you how to do client authentication, including how to recognize that a client is "logged in" to your site.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html

PHP is used to access the request and data model, then generate the HTML, JavaScript and CSS that gets sent to the server.  As such, one PHP script can generate all of the parts of your web page, using PHP control structures to generate different components of the page for different clients, depending on whether they've "logged in" or not.  The single-script design will be simpler than trying to coordinate the work of four different scripts and will get you out of the problem of "Sorry, your browser does not handle frames!"
0
 
LVL 34

Accepted Solution

by:
Slick812 earned 200 total points
ID: 39746744
greetings Ashraf Hassanein, , Your use of the html <FRAMESET> is INCORRECT ! ! as you have TWO <FRAMESET> tags in your index.php html , , and ONLY ONE  <FRAMESET> tag is allowed in a single page html. You will need to REMOVE one of the framesets! ! I went to -
https://www.hassans.nl 
and in firefox, I could NOT SEE the frame with login.php,  There was NO user or password text inputs shown! ! so I could not try to log in. You have a BIG ERROR in your page with two  <FRAMESET> !

ALSO the <FRAMESET> tag is so out of date, and should not be used any more, in this era of html CSS style placement and design, the  <FRAMESET> is NOT NEEDED any longer! It is not recognized or supported as valid in the new HTML5 ! !
0
 

Author Comment

by:Ashraf Hassanein
ID: 39746808
Hi Slick thanks for your support, I am converting it now to div, thanks for your support, thanks for  DamjanDemsar and John for their help.
0
 

Author Closing Comment

by:Ashraf Hassanein
ID: 39746809
Very supportive and helpfule remarks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question