0

Hello everone,
I have a webpage that have a form in iframe now the form submit in iframe and check from database and if found the username and password it start session and when i go to another page the session is lost, now how i can maintain session in iframe and parent widnow the session is start in child window means(iframe) and want to save in parent window to access other pages of website.

<html>
<head>
    <title>parent window</title>
</head>
<body>
<a href'home.php'>Home</a>
<a href'home1.php'>Home1</a>
<a href'home2.php'>Home2</a>
<a href'home3.php'>Home3</a>

<iframe src='login.php'>(after login session starts in this iframe)</iframe>

</body>
</html

After session start when i click on home1 or any other link the session lost
How i can prevent this

Regards

3
Contributors
4
Replies
19
Views
4 Years
Discussion Span
Last Post by LastMitch
0

if found the username and password it start session and when i go to another page the session is lost, now how i can maintain session in iframe and parent widnow the session is start in child window means(iframe) and want to save in parent window to access other pages of website.

Did you include session start() function on top of your iFrame but also did include the connection file that connected tht database?

0

yes i have include the session_start(); in iframe, database file and also in parent window session started successflly and when it checks from database and then set the value in session and i echo the session it show the value but when i goto anyother page it lost the session

0

yes i have include the session_start(); in iframe, database file and also in parent window session started successflly and when it checks from database and then set the value in session and i echo the session it show the value but when i goto anyother page it lost the session

So you have something like this:

<?php 
session_start();
include("folder/database.php");
?>

and it still lost session?

That is weird.

Like what diafol mention are the iframe and parent page on the same domain?

You can take a look at this (it has some code which you can add to your own code):

http://phpmaster.com/writing-custom-session-handlers/

http://phpmaster.com/php-sessions/

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.