473,385 Members | 1,588 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,385 software developers and data experts.

Session dies after HEader redirect

BT3
I appreciate the links on the session variables. I had actually hit that
and finished the login and supporting pages. Thanks for everything.

I noticed that PHP.NET said to do a HEADER Location: for a client re-direct.
When I do that thoughm it seems either the session is destroyed, or the ID
is lost. If I set session variables, then do a Header redirect, the
variables are empty at the new page. While I *could* just say "You are now
logged in, click here to continue", tht sounds kind of silly to me. Any
other way?

bt3of4
Jul 17 '05 #1
4 3335
BT3 wrote:
I appreciate the links on the session variables. I had actually hit that and finished the login and supporting pages. Thanks for everything.

I noticed that PHP.NET said to do a HEADER Location: for a client re-direct. When I do that thoughm it seems either the session is destroyed, or the ID is lost. If I set session variables, then do a Header redirect, the
variables are empty at the new page. While I *could* just say "You are now logged in, click here to continue", tht sounds kind of silly to me. Any other way?


This is known behaviour for non-cookie based sessions. Workaround:
append SID *manually*--but only for redirection.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #2
BT3
new problem.
I'm doing a session_start(); at the beginning of the script.
Towards the end of the script I'm setting up the redirection, but SID
doesn't return anything.

Bt3of4

"BT3" <ho******@epmctc.com> wrote in message
news:JMdfe.876$Db6.565@okepread05...
I appreciate the links on the session variables. I had actually hit that
and finished the login and supporting pages. Thanks for everything.

I noticed that PHP.NET said to do a HEADER Location: for a client re-direct. When I do that thoughm it seems either the session is destroyed, or the ID
is lost. If I set session variables, then do a Header redirect, the
variables are empty at the new page. While I *could* just say "You are now logged in, click here to continue", tht sounds kind of silly to me. Any
other way?

bt3of4

Jul 17 '05 #3
This needs to have a few configuration options changed...

Note that getting the sessionid MUST be called before session_start()
otherwise you will replace the current sessionid.

Therefore you should retrieve it as follows:

session_start();
//your code
session_write_close();
$sessid = session_id();

This way the session is closed and then you can retrieve the id :)

Mike
Jul 17 '05 #4
BT3 wrote:
new problem.
I'm doing a session_start(); at the beginning of the script.
Towards the end of the script I'm setting up the redirection, but SID
doesn't return anything.


That means, session id is not found in the query string. Constant
SID and session_id() function are different.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #5

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

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
7
by: deko | last post by:
I have a login page that is supposed to redirect the user to his private page after login. But header("Location: $url") does not work after I set the $_SESSION variable - I get "Warning: Cannot...
4
by: Dica | last post by:
we've just set up a subdomain, 'demos' for one of our projects that normally works fine. on the login page, if the user enters the correct username/pw, we write session info and then...
10
by: Li Pang | last post by:
Hi, I created a html page from which I give a link to another web site. The new site is opened in a new window. When I opened multiple windows, they all have the same SessionID. I want ot know...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
1
by: leo | last post by:
Hi , i have a problem with session variables. The web site was already working correctly using sessions, i've had to add a page which use a new variable session but this new one doesn't get...
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
18
by: John | last post by:
Something strange has just started to happen as I have been developing a db application on a site. Suddenly a session variable has stopped working as I pass it from 1 page to another (I am sure it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.