473,418 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Session variables through frames - need help.

Hi there,

I have implemented a login sequence using session variables for a PHP/MySQL
DB which I took over development. I read some books and this NG and it
seemed straight forward. However the website I have taken over uses two
frames. The left hand side is always a navigation frame with the righthand
side of the screen always being the target.

I developed a main web page where login takes place and if successful a
session variable is set which all other pages look for before processing (if
it's not there they redirect to login page).

All seems to work OK from my PC until I use another frame as a URL
redirection to the PHP website. Therefore I want to use a nicer URL to where
the actual PHP website is hosted and so set another website to use frame
redirection to my PHP website DB.

When I do this the login session variables no longer seem to work and I can
no longer stay logged in. I assume this is something to do with where the
actual session variables are being set but do not know enough to be sure.
What is the problem and is there an easy way around it?

Any help on this matter greatly appreciated.

Kind regards

Dave
Jul 17 '05 #1
1 2233
On Mon, 02 May 2005 22:58:21 +0100, Dave Smithz wrote:
Hi there,

I have implemented a login sequence using session variables for a PHP/MySQL
DB which I took over development. I read some books and this NG and it
seemed straight forward. However the website I have taken over uses two
frames. The left hand side is always a navigation frame with the righthand
side of the screen always being the target.

I developed a main web page where login takes place and if successful a
session variable is set which all other pages look for before processing (if
it's not there they redirect to login page).

All seems to work OK from my PC until I use another frame as a URL
redirection to the PHP website. Therefore I want to use a nicer URL to where
the actual PHP website is hosted and so set another website to use frame
redirection to my PHP website DB.

When I do this the login session variables no longer seem to work and I can
no longer stay logged in. I assume this is something to do with where the
actual session variables are being set but do not know enough to be sure.
What is the problem and is there an easy way around it?

Any help on this matter greatly appreciated.

Kind regards

Dave


I've played around with frames only a little, but am also using some
iframes and I think the situation is the same.

In a no-frames situation, you have your session_start() call somewhere on
each page's script, and since your browser sends the same session ID, your
session is continued, and your session variables are remembered, from page
request to page request.

In a frames situation, you can have the same thing happen. Each frame
calls its separate source URL. In this case, each of these source URL's
have to be php scripts, and they all have to call session_start()
somewhere at the top of the script.

Since your browser works in the same browser window when loading up
various frames, the browser sends the same session key, so if you do the
above, your session variables are accessible from all frames.

You can also have one frame read in a form on submit, collect the posted
values from $_POST and put them into $_SESSION, so that the posted form
values will be available to other frames.

Hope that helps.
Jul 17 '05 #2

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

Similar topics

13
by: Mimi | last post by:
Hello, I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 ...
4
by: A Web Master | last post by:
I am designing a site for a client where I have a frameset and 3 frames (all in ASP). I am creating session variables in the frameset that need to be accessed in the frames. It seams that in...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
6
by: Rolf Rosenquist | last post by:
From a html page with frames, I have a link to an asp application. When I let it go to a new browser, all the session variables work as intended. But when I link it into the main frame as target,...
2
by: Bonj | last post by:
H I've got the following problem - I need to have an aspx page with two frames, although the question isn't necessarily about the workings of the frames, more session variables... the frames consist...
2
by: KathyB | last post by:
Hi, I'm doing an asp.net app (first one) and NEED to use frames (so please don't tell me not to!). I'm loading a mainframe.htm with two aspx files (for example: left.aspx, right.asp). QUESTION:...
13
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i...
2
by: Iwan Adler | last post by:
hi ich have an asp.net application. on the index.aspx page are 2 iframes. these iframes contain a src to another aspx page from my application. the index page is cached from the iis, also the...
10
by: stathisgotsis | last post by:
Hello everyone, I am having a brain fart or something, why won't this work? test.php: <?php session_start(); $_SESSION='test'; header("Location: test2.php"); exit();
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...
0
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.