473,809 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Causes for $_SESSION to be only visible to current page?

Hi folks,

I am working with PHP 4.3.8, Linux, and Apache 1.3.31 on a third-level or
sub domain.

The following code will diplay foo, session_id(), and increment count over
refreshes:

<?php
session_start() ;
$_SESSION['foo'] = 'bar';
$_SESSION['count']++;
print_r($_SESSI ON);
echo session_id();
?>
<a href="/test2.php">Next Page</a>
But using the link to go to test2.php shows $_SESSION as undefined, not even
an empty array.

<?php
print_r($_SESSI ON);
echo 'Foo is registered? ' . session_is_regi stered('foo');
echo session_id();
?>

Any advice? The docs are quite clear that using session_start() should
produce a persistant session for that browser. In IE the address of the
second page shows no query string. But NN 7 magically shows
http://intranet.mysite.com/test2.php...1ffe394cac2ec7
da7 BUT the page itself does not have the session data in either browser.

Help?

TIA,

jg
Jul 17 '05 #1
7 2329
jerrygarciuh wrote:
Any advice? The docs are quite clear that using session_start() should
produce a persistant session for that browser. In IE the address of the
second page shows no query string. But NN 7 magically shows
http://intranet.mysite.com/test2.php...1ffe394cac2ec7
da7 BUT the page itself does not have the session data in either browser.


session_start() ; in test2.php?

--
Mijn Project Pagina.
Vind mijn documenten, projecten en howto's op
http://www.npi.be
Jul 17 '05 #2
Jean,

Thanks, that solved it but don't you think it is a little bizarre to have
to call that on every page?

It is so counter-intuitive to me!

Thanks for resolving my problem!!

jg
"Jean"
<bl**@boeitmijn iet.be.blah.com .boe.bah.bleh.z ie.je.eindigt.m et.punt.invalid >
wrote in message news:JY******** **************@ phobos.telenet-ops.be...
jerrygarciuh wrote:
Any advice? The docs are quite clear that using session_start() should
produce a persistant session for that browser. In IE the address of the
second page shows no query string. But NN 7 magically shows
http://intranet.mysite.com/test2.php...1ffe394cac2ec7 da7 BUT the page itself does not have the session data in either
browser.
session_start() ; in test2.php?

--
Mijn Project Pagina.
Vind mijn documenten, projecten en howto's op
http://www.npi.be

Jul 17 '05 #3
jerrygarciuh wrote:
Jean,

Thanks, that solved it but don't you think it is a little bizarre to have
to call that on every page?
http://be2.php.net/manual/en/function.session-start.php

It says:
*session_start( )* creates a session or resumes the current one based on
the current session id that's being passed via a request, such as GET,
POST, or a cookie.
It is so counter-intuitive to me!
Sometimes reading the manual helps :D
Thanks for resolving my problem!!


You're welcome.

--
Mijn Project Pagina.
Vind mijn documenten, projecten en howto's op
http://www.npi.be
Jul 17 '05 #4
*** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:05:02 -0500):
But using the link to go to test2.php shows $_SESSION as undefined, not even
an empty array.

<?php
print_r($_SESSI ON);
echo 'Foo is registered? ' . session_is_regi stered('foo');
echo session_id();
?> Any advice? The docs are quite clear that using session_start() should
produce a persistant session for that browser.


Yet you haven't used session_start() , at least in the code you paste :-?
--
--
-+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
+- http://www.demogracia.com (la web de humor para mayores de 100 años)
++ «Sonríe, que te vamos a hacer una foto para la esquela»
--
Jul 17 '05 #5
*** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:23:13 -0500):
Thanks, that solved it but don't you think it is a little bizarre to have
to call that on every page?


What if you don't need session data in 95% of your pages?
--
--
-+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
+- http://www.demogracia.com (la web de humor para mayores de 100 años)
++ «Sonríe, que te vamos a hacer una foto para la esquela»
--
Jul 17 '05 #6
Thanks!
jg
"Alvaro G. Vicario" <kA************ *****@terra.es> wrote in message
news:1h******** *************** *****@40tude.ne t...
*** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:05:02 -0500):
But using the link to go to test2.php shows $_SESSION as undefined, not even an empty array.

<?php
print_r($_SESSI ON);
echo 'Foo is registered? ' . session_is_regi stered('foo');
echo session_id();
?>

Any advice? The docs are quite clear that using session_start() should
produce a persistant session for that browser.


Yet you haven't used session_start() , at least in the code you paste :-?
--
--
-+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
+- http://www.demogracia.com (la web de humor para mayores de 100 años)
++ «Sonríe, que te vamos a hacer una foto para la esquela»
--

Jul 17 '05 #7
Excellent point!
jg
"Alvaro G. Vicario" <kA************ *****@terra.es> wrote in message
news:8x******** *************** *****@40tude.ne t...
*** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:23:13 -0500):
Thanks, that solved it but don't you think it is a little bizarre to have to call that on every page?


What if you don't need session data in 95% of your pages?
--
--
-+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
+- http://www.demogracia.com (la web de humor para mayores de 100 años)
++ «Sonríe, que te vamos a hacer una foto para la esquela»
--

Jul 17 '05 #8

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

Similar topics

4
6168
by: B-B | last post by:
Platform: Win2k Server, Apache 1.3, PHP 4.2.3 I understand that when using $_SESSION variables, using the "session_register()" function should not be done. I have seen no documentation pertaining the the "why" of this, but I am removing the offending statements from my code anyway. Prior to discovering this tidbit, I had been attempting to save some arrrays in individually registered variables. But the arrays were not being saved...
13
23342
by: Mimi | last post by:
Hello, I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 The problem I am having is that each time I reload the same PHP page, I get
18
12705
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
1
1291
by: Eric | last post by:
How come a user control on an ASPX page that has visible set to false causes blank lines? We have an ASPX page with many hidden user controls on it, where we make the one we need visible. If the visible control is positioned last on the ASPX page it will be set lower on the page then when the top one is made visible. Seems like there is a bug in hidden user controls where they cause a blank line. Any suggestions? Thanks.
6
1958
by: Don | last post by:
I have a page with several controls on the page and all except one are hidden. This page works like a wizard by hiding and showing controls has the user clicks next. The control are hidden by setting visible=false in the code-behind, so they are never rendered. My next button validates the page and on some controls I get the JavaScript error below: Error: 'undefined' is null or not an object Code: 0 The control that causes this...
12
41198
by: Michael Windsor | last post by:
I've been trying to integrate some PHP pages of my own with some existing code. The details of this are for the support forums for that code (where I have been asking questions), but I wonder if someone here can enlighten me as to why the problematic code is having the effect it is. For reasons I don't know, if the PHP version is 5 or greater, register_long_arrays is false and $_SESSION exists, the following statement is executed: ...
2
2268
by: sharonDonnelly | last post by:
Hi Really dumb problem that's got me beat. Can someone help. The prolem: I'm trying to count the number of times an item has been clicked. There are many items. I want to create a session variable for each item as its clicked, and increment the value held by the session variable by 1 each time that item is clicked. My plan was to allow an item to be selected on one page - when a user selects an item, a numeric value will be passed to a...
3
2185
by: JRough | last post by:
I want to save two variables in a $_SESSION for use in another page: $_SESSION = $mark; $_SESSION = $num; then on the other page I did this to get the value: $mark =$_SESSION; $num = $_SESSION;
4
1813
TheServant
by: TheServant | last post by:
Hi guys, This is my situation. I have 3 sets of data used on every page of my website. Two of these never change, and the reason they are stored in MySQL and recalled into the $_SESSION variable is simply because I want to have one place to update/change them if I ever need to. What I have been wondering is if I should leave the user specific variables in the session, and define the other variables in another file/array which is called on...
0
9600
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
10633
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
10375
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
10114
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...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
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
5548
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
4331
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
3011
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.