Session data is getting lost in PHP version 4.4.1 which used to work in
version 4.3.3
The code is similar to the one below
Assume the file is called count.php which requires a parameter
productid;
session_start() ;
if (!isset($_SESSI ON['countAccess'])) $_SESSION['countAccess'] = 0;
else $_SESSION['countAccess']++;
echo $_SESSION['countAccess'];
if I call the script with a parameter for example
count.php?produ ctid=78
when I press refresh button $_SESSION['countAccess'] does not get
incremented but if I call it without the parameter,
$_SESSION['countAccess'] gets incremented.
I am also losing data if I call another script.
Does anyone know what's going on here?
Thank you 15 2334 jk*****@gmail.c om wrote: Session data is getting lost in PHP version 4.4.1 which used to work in version 4.3.3
The code is similar to the one below
Assume the file is called count.php which requires a parameter productid;
session_start() ; if (!isset($_SESSI ON['countAccess'])) $_SESSION['countAccess'] = 0; else $_SESSION['countAccess']++;
echo $_SESSION['countAccess'];
Why don't you use {} to mark your logical blocks?
This is PHP, not python. ;-)
Like:
session_start() ;
if (!isset($_SESSI ON['countAccess'])) {
$_SESSION['countAccess'] = 0;
} else {
$_SESSION['countAccess']++;
}
echo $_SESSION['countAccess'];
if I call the script with a parameter for example count.php?produ ctid=78
when I press refresh button $_SESSION['countAccess'] does not get incremented but if I call it without the parameter, $_SESSION['countAccess'] gets incremented.
That ?productid=78 has nothing to do with the SESSION.
It will appear in $_GET, not $_SESSION.
So this is very surprising.
Do you have more code, without {}, that might interfere?
If yes: fix it, and if the problem persists, show us the code.
I am also losing data if I call another script.
Does anyone know what's going on here?
Thank you
Regards,
Erwin Moller
Works for me on 3.3.10 and 4.4.1
Must be one of your settings or something elsewhere in the script
When you use one statement in an if-else block you dont need {} for all
C type languages. {} are only used to group statements
I apologize the problem was not with the parameter. The code is working
sometimes and other times it does not work whether I am using a
paramter or not. The first time I tested the ecript today it was not
working, then I addeda simple echo statement to display a string. Then
the script worked OK. This is the setting of my session in php.ini
session
Session Support enabled
Registered save handlers files user
Directive Local Value Master Value
session.auto_st art Off Off
session.bug_com pat_42 On On
session.bug_com pat_warn On On
session.cache_e xpire 180 180
session.cache_l imiter nocache nocache
session.cookie_ domain no value no value
session.cookie_ lifetime 0 0
session.cookie_ path / /
session.cookie_ secure Off Off
session.entropy _file no value no value
session.entropy _length 0 0
session.gc_divi sor 100 100
session.gc_maxl ifetime 1440 1440
session.gc_prob ability 1 1
session.name PHPSESSID PHPSESSID
session.referer _check no value no value
session.save_ha ndler files files
session.save_pa th /tmp /tmp
session.seriali ze_handler php php
session.use_coo kies On On
session.use_onl y_cookies Off Off
session.use_tra ns_sid Off Off
I apologize the problem was not with the parameter. The code is working
sometimes and other times it does not work whether I am using a
paramter or not. The first time I tested the ecript today it was not
working, then I addeda simple echo statement to display a string. Then
the script worked OK. This is the setting of my session in php.ini
session
Session Support enabled
Registered save handlers files user
Directive Local Value Master Value
session.auto_st art Off Off
session.bug_com pat_42 On On
session.bug_com pat_warn On On
session.cache_e xpire 180 180
session.cache_l imiter nocache nocache
session.cookie_ domain no value no value
session.cookie_ lifetime 0 0
session.cookie_ path / /
session.cookie_ secure Off Off
session.entropy _file no value no value
session.entropy _length 0 0
session.gc_divi sor 100 100
session.gc_maxl ifetime 1440 1440
session.gc_prob ability 1 1
session.name PHPSESSID PHPSESSID
session.referer _check no value no value
session.save_ha ndler files files
session.save_pa th /tmp /tmp
session.seriali ze_handler php php
session.use_coo kies On On
session.use_onl y_cookies Off Off
session.use_tra ns_sid Off Off
I have discovered what the problem was. I installed Zone Alarm Internet
Security Suite and it appears its blocking the session information. I
have disabled it and the system is working fine now.
Sorry, still works every time, even with your ini file - could it be a
caching thing?
What OS and browser are you on?
Sorry, still works every time, even with your ini file - could it be a
caching thing?
What OS and browser are you on?
The problem was being caused by zone alarm internet security software
blocking sessions. I do not understand why it's doing this for. I
wanted to buy it but now I will think twice before I buy it.
I thought the problem could have been due to my web hosting company
updating the PHP version and not setting up the session values
properly.
Thank you for taking your time to help me with this problem This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Perdit |
last post by:
My 1st page calls a 2nd that uses same data from a database. What is
the best way to get the data in the second: a new call to the database
or passing array through session variable??
I seems to me that avoiding a new call will speed up things but my
concerne is that I have read many posts with caution messages againts
session vars.
Has anybody tested session var stability in this common scenario?
|
by: Billy Jacobs |
last post by:
I am having a problem with my session variable being set
to Null for no apparent reason.
I am declaring it like the following when the user logs in.
dim objUserInfo as new clsUserInfo
'Set some properties
objUserInfo.UserName = txtUserName.text.trim
objUserInfo...
|
by: Chris |
last post by:
When a request comes into a page on my ASP.net site and a session is
not found, I want to detect whether the request is an initial request
or if the user did have a session going that has now been lost and
show an explanatory message before restarting the session.
Rather than tagging a 'session in progress' flag on the end of every
request querystring I'd like to detect it using data sent in every
request.
One idea I had was that when...
|
by: William |
last post by:
Hi
I have an ASP.NET application that connects to an Access database.
Everything works fine except for the Session object. Data in the session
object is lost after I've made a call to the database.
To test, I've created two test aspx pages. Test1.aspx contains two buttons.
The first button sets values in the session object and then navigates to
Test2.aspx. Test2.aspx only displays the values in the session object.
The second button...
|
by: Venkat Chellam |
last post by:
I have a peculiar problem. I have a simple web application which loads
some data from the oracle table and display in the datagrid in the
webpage and datagrid has page enabled which shows 10 rows at a page.I
have a search criteria to search the records based on the data range i
give
This is what i have done, in the !IsPostBack section. I am setting up
the oracle connection, creating dataset object, datadapter and i aslo
load the data...
| |
by: Paul H |
last post by:
Hi
I have a problem with certain users of my ASP.NET application. The user logs
into the site, and they are logged into the application. Then when they
select a link, they are presented with a "User session has timed out. Please
log in again" error message. They enter their login details again, and this
time the login works fine.
The session data seems to be getting lost. I've tried reconfiguring the
application to use SQL Server to...
|
by: Sarah Marriott |
last post by:
Our website contains session variables that are used to validate if a user is
logged in etc. We have found that these variables are randomly lost while
navigating the website.
We set up some basic code (as shown below) which used a meta tag to refresh
an aspx page every second. It tests whether there is any content in a
session variable, if not then it writes a timestamp to a text file, recreates
the data in the variable and continues....
|
by: maxkumar |
last post by:
Hi,
I am running a ASP.NET 1.1 site on Win Server 2003 with IIS 6.0. The website
has been running for about 1.5 years now. In the past, we used to have random
cases of session variables getting lost, but not frequently. However, since
the past 2 weeks, I am noticing an alarming increase of such session
variables lost cases. My application log shows about 20-30 such errors every
day. We have not changed anything at the server for a long...
|
by: davidkoree |
last post by:
I mean not about cookie.
Does it have something to do with operating system or browser plugin?
I appreciate any help.
|
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...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |