473,671 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3352
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******@epmct c.com> wrote in message
news:JMdfe.876$ Db6.565@okeprea d05...
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_c lose();
$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
7782
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: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
27
7113
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 a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
7
11155
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 modify header information - headers already sent by ... The abbreviated code on the login page looks like this: <?php session_start(); ?>
4
1689
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 response.redirect to the home page. this works for on the normal site, but session state info is dying on the demo subdomain. i'm sure the session info is being written since i can see it when i response.write the value. also, the response.redirect uses a...
10
2183
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 how to open the windows with different sessionID. Thanks
4
11425
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 XMLHTTP object. However, when the page requested through the XML object makes a <%Response.Redirect()%> call, a new session is created each time. Is this a flaw in the XMLHTTP Object? How can I force the session to remain the same after a...
1
3233
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 registered, so when the page redirect to another one the new variable is vanished. Here a snippet of the code: <?php unset($_SESSION);
9
7796
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 in sessions? I can see active sessions in my mysql database, but is that the only place this information is stored? Sessions and cookies I know are related also, but how specifically (session info stored in cookies?)? Right now, when users...
18
1734
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 was OK a few days ago). I have done some tests. $temp = 67; echo $temp; gives 67 on this page S_SESSION = $temp;
0
8481
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8602
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6234
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.