I have to share a variable between browser sessions.
One session for example changes the variable, the other sessions must
see the changes (get the new value instead of the original value)
it's not allowed to save the value in a database or to save it into a
file. It must be a kind of global server variable, changeable by every
session.
tia 5 8563
You could use an environment variable ($_ENV['foobar'])
Ikke wrote: I have to share a variable between browser sessions. One session for example changes the variable, the other sessions must
see the changes (get the new value instead of the original value) it's not allowed to save the value in a database or to save it into a
file. It must be a kind of global server variable, changeable by
every session.
tia ti****@gmail.co m wrote: Ikke wrote: I have to share a variable between browser sessions. One session for example changes the variable, the other sessions must see the changes (get the new value instead of the original value) it's not allowed to save the value in a database or to save it into a file. It must be a kind of global server variable, changeable by every session.
There are shared memory functions in PHP which may be able to accomplish
what you are after: http://www.php.net/manual/en/ref.sem.php
But other than that (if the above functions do not work) you can't do
this without saving it into some sort of state file or database table.
Is there any reason you don't want to do this? The problem with non
persistant data that is only stored in memory is that if the web
service or server is restarted then you're going to lose whatever the
current value is.
You could use an environment variable ($_ENV['foobar'])
That wouldn't hold from page to page. Whatever you set in $_ENV will
only last for the duration that the page is parsed.
--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
hi tia,
if i got you right, you want to write data from session into another.
The gap there is you will have to know the session-id from each session.
if you know them, you can accomplish the task with the following code:
<?php
// SESSION-ID of the session to write in is in $newSessId;
// Save data from current Session
session_write_c lose();
$oldSessId= session_id($new SessId);
// Change to new Session
session_start() ;
// Delete/Alter data into Session
unset($_SESSION['unsetvar']);
$_SESSION['altervar']="newvalue";
// Save changes into Session
session_write_c lose();
// Switch back to previous session
session_id($old SessId);
session_start() ;
?>
best regards
deniz adrian
Ikke wrote: I have to share a variable between browser sessions. One session for example changes the variable, the other sessions must see the changes (get the new value instead of the original value) it's not allowed to save the value in a database or to save it into a file. It must be a kind of global server variable, changeable by every session.
tia
What about cookies?
"Ikke" <ik******@hotma il.com> ???????/???????? ? ???????? ?????????:
news:42******** *************** @news.wanadoo.n l... I have to share a variable between browser sessions. One session for example changes the variable, the other sessions must see the changes (get the new value instead of the original value) it's not allowed to save the value in a database or to save it into a file. It must be a kind of global server variable, changeable by every session.
tia
--
Happy PHP'ing,(c) Team Zend This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tom |
last post by:
Hi,
I would like to use the standard PHP sessions and I understand they rely on
the target web browser to support session cookies.
I have tried the following code:
<?
session_start();
if (!session_id()) { //no support for session
|
by: Daniel |
last post by:
right now i have some sql server tables that i search for a value w/ a key
each time a .aspx is hit. is there any way i can just have the first hit to
the .aspx select all the entries from the key/value table in to some kind of
hash table so that subsequent hits to the .aspx get the data from the hash
table instead of the database? e.g. is there any way to share a hash table
between aspx sessions? can application variable do this or is...
|
by: Sara T. |
last post by:
All,
How can I share variable between web site ?
I mean that I have two web sites but I need to use the same variable, how
can I do ? I try to use session or application but it doesn't work.
PS: I use VB.NET to write web application in ASP.NET
Thanks for advance.
|
by: Wayne Wengert |
last post by:
Are Session variables the same as a cookie? In reading a couple of pages I
got from searches, I don't get the difference. Basically, I am currently
using simple session variables (e.g. Session("UserName") =
txtLastName.Text). I think they are expiring for some users (longer
sessions?) and I need to be able to set the expiration to something like
Now() plus 2 hours.
What is the right way to do this?
Wayne
|
by: mateus |
last post by:
print "hello world"
I have a nested loop where the outer loop iterates over key value pairs
of a dictionary and the inner loop iterates over a list each list of
which is a mapped value from the dictionary
def showReport(self):
for dev, sessions in self.logger.items():
for tree in session:
self.addTestItem(self, tree)
| |
by: dotnetmuddu |
last post by:
Hi,
Have you guys come across this ? Can I share the session state between virtual directories.
Ex :
I have Virtual Dir SessionTest1 & SessionTest2. If a variable Session = "testuser" which is in WebForm1.aspx.cs of SessionTest1 Project be accessible at SessionTest2's WebForm1.aspx.cs
Please reply if any one of you have got the answer for this Questions.
|
by: laredotornado |
last post by:
Hi,
When a user logs into our site, we create a session variable to denote
the session is active and another to denote who is logged in. Once
the user closes the browser and re-opens it, the session is destroyed
and the variables are gone.
How can I keep the session alive for 24 hours even if the user closes
and re-opens the browser?
|
by: YYZ |
last post by:
I'm using asp, not asp.net. I've got some open ended questions that I
was really hoping someone in here could answer, or direct me to some
resources that will help me answer them on my own.
First, the session object. When a new user comes to my site, asp
creates a session object, and a session id on that object. That
session id is sent back to the client and stored as a cookie(?) that
can be used to identify a single user across...
|
by: Immortal Nephi |
last post by:
First class is the base class. It has two data: m_Base1 and m_Base2.
Second class and third class are derived classes and they are derived
from first class. m_Base1 and m_Base2 are inherited into two derived
classes.
Second class has its own m_Base1 and m_Base2 and third class does the
same. I am curious. How can second class and third class share the
same m_Base1 and m_Base2?
You define second class first and enter data into...
|
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: 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: 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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |