473,800 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session maintenance

I'm trying to get a better feel for exactly how sessions work.

At the beginning of a web page, I do either a session_start() or a
session_registe r(...). When the user goes to the next page, I know the page
needs to get the SSID. I know I can send it as a cookie, hidden field, etc,
but what other ways are available to send it? For example, I know that
session_registe ring variables at the top of the second page works.

If the user visits any pure html pages (extension html), how can I get the
session back when they come back to my php pages. Without php on the page,
how can I propagate the SSID?

thanks in advance
---Michael

Jul 17 '05 #1
13 2300
Michael Satterwhite wrote:
I'm trying to get a better feel for exactly how sessions work.

At the beginning of a web page, I do either a session_start() or a
session_registe r(...). When the user goes to the next page, I know the page needs to get the SSID. I know I can send it as a cookie, hidden field, etc, but what other ways are available to send it? For example, I know that session_registe ring variables at the top of the second page works.

If the user visits any pure html pages (extension html), how can I get the session back when they come back to my php pages. Without php on the page, how can I propagate the SSID?


IMHO, there is no way to carry the session id in pure html pages.
Probably you may need to force the html pages to be parsed by PHP (by
settings in Apache). May also want to try trans sid setting.
session_registe r() is obsolete. Please refer manual
<http://www.php.net/session>

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

Jul 17 '05 #2
*** Michael Satterwhite escribió/wrote (Sun, 13 Feb 2005 15:32:11 GMT):
If the user visits any pure html pages (extension html), how can I get the
session back when they come back to my php pages.


Just let PHP take care of it with the default solution: cookies.
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Jul 17 '05 #3
Michael Satterwhite wrote:
At the beginning of a web page, I do either a session_start() or a
session_registe r(...).


You don't want to use session_registe r(). Use the $_SESSION array.

Regards,
Matthias
Jul 17 '05 #4
> At the beginning of a web page, I do either a session_start() or a
session_registe r(...).
You do a session_start() . session_registe r() is obsolete. :)
When the user goes to the next page, I know the
page needs to get the SSID. I know I can send it as a cookie, hidden
field, etc, but what other ways are available to send it? For example, I
know that session_registe ring variables at the top of the second page
works.
The session handling in PHP does this for you automatically. Just call
session_start() at the very top of each page and PHP will pick up the
session id and restore the $_SESSION array for you. For many (most?)
purposes you don't *need* to know what the session ID is or how it is sent.
(It normally goes via a cookie and you can find the value with
session_id().)
If the user visits any pure html pages (extension html), how can I get the
session back when they come back to my php pages. Without php on the page,
how can I propagate the SSID?


Any page that needs the session ID just calls session_start() at the top.
That makes $_SESSION available. If you have any pages (PHP or HTML) that
don't need the session just ignore it by not calling session_start() . The
session ID is propagated automatically by the browser, which sends it with
each page request. If the server doesn't use (or even look at) that cookie,
that won't stop the browser sending it with the next page request.

--
The email address used to post is a spam pit. Contact me at
http://www.derekfountain.org : <a
href="http://www.derekfounta in.org/">Derek Fountain</a>
Jul 17 '05 #5
Michael Satterwhite <sa************ *****@weblore.c om> writes:
I'm trying to get a better feel for exactly how sessions work.

At the beginning of a web page, I do either a session_start() or a
session_registe r(...). When the user goes to the next page, I know the page
needs to get the SSID. I know I can send it as a cookie, hidden field, etc,
but what other ways are available to send it? For example, I know that
session_registe ring variables at the top of the second page works.

If the user visits any pure html pages (extension html), how can I get the
session back when they come back to my php pages. Without php on the page,
how can I propagate the SSID?
The cookie SID storage method is going to result in the client sending
the SID cookie with each request to a qualified directory regardless
of the target page being a static file or script.
thanks in advance
---Michael


--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/
Jul 17 '05 #6
Jerry Sievers wrote:
Michael Satterwhite <sa************ *****@weblore.c om> writes:
I'm trying to get a better feel for exactly how sessions work.

At the beginning of a web page, I do either a session_start() or a
session_registe r(...). When the user goes to the next page, I know the
page needs to get the SSID. I know I can send it as a cookie, hidden
field, etc, but what other ways are available to send it? For example, I
know that session_registe ring variables at the top of the second page
works.

If the user visits any pure html pages (extension html), how can I get
the session back when they come back to my php pages. Without php on the
page, how can I propagate the SSID?


The cookie SID storage method is going to result in the client sending
the SID cookie with each request to a qualified directory regardless
of the target page being a static file or script.


Exactly what are you referring to here? I'm feeling very ignorant at this
point.

thanks much
---Michael

Jul 17 '05 #7
Michael Satterwhite <sa************ *****@weblore.c om> writes:
Jerry Sievers wrote:
Michael Satterwhite <sa************ *****@weblore.c om> writes:
The cookie SID storage method is going to result in the client sending
the SID cookie with each request to a qualified directory regardless
of the target page being a static file or script.
Exactly what are you referring to here? I'm feeling very ignorant at this
point.


I don't know where to begin. You have read all the PHP docs that
pertain to sessions, right?

Among possible others, the session ID can be sent to the server by a
query parameter in the URL or a cookie.

You should dig through the bunches of session related PHP config
settings to get a better idea what's possible.

I prefer to force cookies and disable transparent SID;

php_flag session.auto_st art on
php_flag session.use_onl y_cookies on
php_flag session.use_tra ns_sid off

I don't know is this helps or not.

Good luck. Sessions are hairy but very useful.

thanks much
---Michael


--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/

--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/
Jul 17 '05 #8
Jerry Sievers wrote:
Michael Satterwhite <sa************ *****@weblore.c om> writes:
Jerry Sievers wrote:
> Michael Satterwhite <sa************ *****@weblore.c om> writes:
>
>
> The cookie SID storage method is going to result in the client sending
> the SID cookie with each request to a qualified directory regardless
> of the target page being a static file or script.


Exactly what are you referring to here? I'm feeling very ignorant at this
point.


I don't know where to begin. You have read all the PHP docs that
pertain to sessions, right?


Absolutely ... and have been using sessions. My question here is specific
to: "What are you referring to by the "cookie SID storage method"?

I know that I can send the SID in many ways, but it is my understanding that
*I* have to send it (post, cookie, whatever). The post I'm replying to is
(I believe) implying that once I send it the server is going to continue to
send it - even to downstream pages where I haven't sent it. I would love
for that to be true (and, in my ignorance, I allow for the fact that it may
be!) but I haven't seen - or have missed - anything in the documentation
that says that. If there *IS* a storage method that propagates the SID to
downstream pages, I really want to understand it so that I can use it.

Jul 17 '05 #9
Michael Satterwhite <sa************ *****@weblore.c om> writes:
Jerry Sievers wrote:
Absolutely ... and have been using sessions. My question here is specific
to: "What are you referring to by the "cookie SID storage method"?

I know that I can send the SID in many ways, but it is my understanding that
*I* have to send it (post, cookie, whatever). The post I'm replying to is
(I believe) implying that once I send it the server is going to continue to
send it - even to downstream pages where I haven't sent it. I would love
for that to be true (and, in my ignorance, I allow for the fact that it may
be!) but I haven't seen - or have missed - anything in the documentation
that says that. If there *IS* a storage method that propagates the SID to
downstream pages, I really want to understand it so that I can use it.
I have NOT done any actual R&D to verify this but it's likely that the
server send the set cookie header only the first time on session start
if it doesn't get a SID.

From that point, the client sends the cookie to identify the session.

And it should send this cookie to any URL that the cookie is intended
for which I believe on sessions (the default) is the entire site.

HTH


--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/
Jul 17 '05 #10

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

Similar topics

3
9161
by: StinkFinger | last post by:
Hello all, I am working on some simple pages that pass non-critical information (i.e. no passwords, usernames, etc.) to and from different pages. Currently, I am using FORMs w/the POST method. I am not using any cookies or anything stored on the client end, simply passing data. Should I read up on SESSIONS and use those instead of POST ? What are the benefits/drawbacks by switching to SESSIONS ?
11
1409
by: Cecil Westerhof | last post by:
Is it possible to end a session a from another session b, if I know the SessionID from a?
2
1710
by: adam | last post by:
Having spent nearly 2 years in win forms land the inevitable request came for me to "do some web pages". So being new to this bit of .net and having had a look around I can't see where the best way to store session data. 1) use the (string)Session approach Obviously bad for maintenance, readability etc. 2) have a typed MySession object with static properties for each value I want to store
5
2826
by: Jason Collins | last post by:
There are a number of stored procedures involved in sql server based session maintenance: - TempUpdateStateItemShort - TempResetTimeout - TempUpdateStateItemLong etc. These stored procs are executed by the framework, e.g., exec TempResetTimeout @id = '1iucllii0f42ksvfg4zsajae00000001'
2
2579
by: Bishop | last post by:
Here is my situation. I'm building a web based store that will use the same code base for every store using host headers to determine which data to display. To prevent purchasing a SSL Cert for each domain I want to redirect the checkout process to a different domain. I have two or three session variables that contain sensitive data that I don't want to pass across the address line or session cookie. Any thoughts on how I can pass the...
8
4756
by: =?Utf-8?B?TmF0ZQ==?= | last post by:
All, My department has recently been tasked with converting an ASP 3.0 web application to an ASP.NET 2.0 web application. Currently, in order to read values from the ASP 3.0 Session from an ASP.NET web page we have to use a session bridging technique. There are several techniques out there to workaround the incompatibility of the 2 session state storage mechanisms (3.0 vs .NET). The problem that I have with all of the techniques is...
11
7924
by: Joseph Geretz | last post by:
I've been looking at two approaches for the maintenance of Session state for a Web Service application. One approach uses the old familiar Session object which I've used in the past for Web applications. As far as I can see, the Session approach is non-standard since Web Services are supposed to be agnostic with respect to their clients. It seems that cookies are outside the Web Service standard; therefore, such a Web Service application...
17
5095
by: Control Freq | last post by:
Hi, Not sure if this is the right NG for this, but, is there a convention for the variable names of a Session variable? I am using .NET 2.0 in C#. I am new to all this .NET stuff, So, any guidance appreciated. Regards
4
5328
by: Bjorn Sagbakken | last post by:
In a web-application with login creds (user, pwd), these are checked against a user table on a SQL server. On a positive validation I have saved the userID, name, custno and role-settings in a userobject (custom build class) and added this to the session using as session variable like session For all other pages I have added a small test in the page_load event, basically testing if the session != null, but also checking if the...
0
9691
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
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
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
10035
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
7580
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
6813
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4149
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
3
2945
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.