Hey friends,
i am calling one login page of one server on the frameset of another page. but i am getting problem when in that frame i am trying to log in, that login page actually passes the values of id and password with session variable but that second page doesn't get the session variables value when i am using the page in frame of anorhet web site.
but when i am directlly access that login page from it's own server it works.
i think to use that login page in another web site i will required to set some setting.
PHP Session variable
Moderator: General Moderators
Re: PHP Session variable
A session variable is stored on the server, so of course it is not available on another server unless you pass it as a $_GET por $_POST parameter, then, if necessary, create a new session variable on the other server.arvind_bhoir2001 wrote:Hey friends,
i am calling one login page of one server on the frameset of another page. but i am getting problem when in that frame i am trying to log in, that login page actually passes the values of id and password with session variable but that second page doesn't get the session variables value when i am using the page in frame of anorhet web site.
but when i am directlly access that login page from it's own server it works.
i think to use that login page in another web site i will required to set some setting.
-
arvind_bhoir2001
- Forum Newbie
- Posts: 2
- Joined: Fri Feb 15, 2008 1:03 am
Re: PHP Session variable
ur correct, but i think u have not got my problem
take an example, i have two domains http://www.abc.com & http://www.xyz.com
my whole site is on abc.com, but after some time my client thought that the spelling of abc.com is wrong & they want to change that, so i buy the xyz.com and they told me that they want to use both the domains. so i just included frameset in index file of xyz.com and called index file of abc.com in that one frame. in my xyz.com i just have index file nothing else.
still i am accessing the pages and all database of abc.com only.
so when i am accessing the login page directlly from abc.com it works even my validation code is on same login.php page which contains some session variables(they works properlly when i am accessing the login page through xyz.php), but when i am accessing same page through xyz.com then for passing session variable to another page it doesn't work.
can still i have to use $_GET por $_POST methods, because i have lots of session variables in my project so it is not possible for me to convert all variables in $_GET por $_POST format.
the easy way is i can transfer my server(i can directlly store my all files which r on abc.com to the xyz.com), but i want to use both server simultaniouslly. is there is any solution.
take an example, i have two domains http://www.abc.com & http://www.xyz.com
my whole site is on abc.com, but after some time my client thought that the spelling of abc.com is wrong & they want to change that, so i buy the xyz.com and they told me that they want to use both the domains. so i just included frameset in index file of xyz.com and called index file of abc.com in that one frame. in my xyz.com i just have index file nothing else.
still i am accessing the pages and all database of abc.com only.
so when i am accessing the login page directlly from abc.com it works even my validation code is on same login.php page which contains some session variables(they works properlly when i am accessing the login page through xyz.php), but when i am accessing same page through xyz.com then for passing session variable to another page it doesn't work.
can still i have to use $_GET por $_POST methods, because i have lots of session variables in my project so it is not possible for me to convert all variables in $_GET por $_POST format.
the easy way is i can transfer my server(i can directlly store my all files which r on abc.com to the xyz.com), but i want to use both server simultaniouslly. is there is any solution.
Re: PHP Session variable
I think that califdon 'gets' your problem, but that you haven't quite 'got' his response.
If your domains are two on physically separate servers, and the session data is stored on the server, then why should one server have access to data stored on another?
If you want user data stored to be portable, then you would probably be best to push the data into a cookie. This of course exposes you to a lot of security issues, in that you cant trust any of that data because it is available to the user.
There are a few other session workarounds I can think of, but the simpler option would be to get your host to just set the primary domain up as an alias for the secondary. Many hosts have the ability to allow this, and should require absolutely no intervention (not even the frameset. A few of my hosting plans have allowed for multiple domain hosting, but I think domain aliasing has been standard for pretty much all of the plans I have ever had.
If your domains are two on physically separate servers, and the session data is stored on the server, then why should one server have access to data stored on another?
If you want user data stored to be portable, then you would probably be best to push the data into a cookie. This of course exposes you to a lot of security issues, in that you cant trust any of that data because it is available to the user.
There are a few other session workarounds I can think of, but the simpler option would be to get your host to just set the primary domain up as an alias for the secondary. Many hosts have the ability to allow this, and should require absolutely no intervention (not even the frameset. A few of my hosting plans have allowed for multiple domain hosting, but I think domain aliasing has been standard for pretty much all of the plans I have ever had.
Re: PHP Session variable
Basically, a session variable is tied to the domain that established it, otherwise one server couldn't manage multiple domains, which they commonly do. So you will never succeed in reading a session variable that was set by a script run from a different domain. At least I'm pretty sure that's the case.arvind_bhoir2001 wrote:ur correct, but i think u have not got my problem
take an example, i have two domains http://www.abc.com & http://www.xyz.com
my whole site is on abc.com, but after some time my client thought that the spelling of abc.com is wrong & they want to change that, so i buy the xyz.com and they told me that they want to use both the domains. so i just included frameset in index file of xyz.com and called index file of abc.com in that one frame. in my xyz.com i just have index file nothing else.
still i am accessing the pages and all database of abc.com only.
so when i am accessing the login page directlly from abc.com it works even my validation code is on same login.php page which contains some session variables(they works properlly when i am accessing the login page through xyz.php), but when i am accessing same page through xyz.com then for passing session variable to another page it doesn't work.
can still i have to use $_GET por $_POST methods, because i have lots of session variables in my project so it is not possible for me to convert all variables in $_GET por $_POST format.
the easy way is i can transfer my server(i can directlly store my all files which r on abc.com to the xyz.com), but i want to use both server simultaniouslly. is there is any solution.
Re: PHP Session variable
I thought that maybe it would be possible, if you really wanted to, to have PHP add the session ID as a get parameter to the page to be loaded into the frame.
I didn't think much further than that though. I can see it working for one page, but subsequent calls might prove problematic.
Anywho ...
I didn't think much further than that though. I can see it working for one page, but subsequent calls might prove problematic.
Anywho ...