How can I share session registered variables between different processes?
Here is my problem:
File 1:
-----------------------------------------------------------------------
<?php
session_start() ;
$var1="This should";
$var2="be displayed";
$_SESSION[ 'var1' ]=$var1;
$_SESSION[ 'var2' ]=$var2;
if (session_is_reg istered('var1') ) {
print "Var1 is registered<br>" ;
}
if (session_is_reg istered('var2') ) {
print "Var2 is registered<br>" ;
}
print "<A HREF=/work/test2.php>Secon d File</A>";
?>
File 2:
-----------------------------------------------------------------------
<?php
if (session_is_reg istered('var1') ) {
print "test2:Var1 is registered<br>" ;
}
if (session_is_reg istered('var2') ) {
print "test2:Var2 is registered<br>" ;
}
$var1=$_SESSION[ 'var1' ];
$var2=$_SESSION[ 'var2' ];
print "$var1 $var2 <br>";
?>
In file test2.php neither variable is reported as a session registered
variable and nothing is displayed. File /tmp/sess* has the correct
contents:
var1|s:11:"This should";var2|s: 12:"be displayed";
How can I establish real global variables, ones which will
be visible in both files? I thought that httpd was supposed
to read the sessxxxxx file, depending on the cookie received from
the browser and establish those global variables.
I apologize if it is a beginer question, but I was unable to
answer it either through the O'Reilly book or PHP online literature.
I'm at the verge of re-installing PHP 4.3.36 with shmop module enabled.
--
Trust me, I know what I'm doing. (Sledge Hammer) 3 2466
make sure you add:
session_start() ;
and the top of each page that you want to access the variables in.
"Mladen Gogala" <go****@sbcglob al.net> wrote in message
news:pa******** *************** *****@sbcglobal .net... How can I share session registered variables between different processes? Here is my problem: File 1: ----------------------------------------------------------------------- <?php session_start() ; $var1="This should"; $var2="be displayed"; $_SESSION[ 'var1' ]=$var1; $_SESSION[ 'var2' ]=$var2; if (session_is_reg istered('var1') ) { print "Var1 is registered<br>" ; } if (session_is_reg istered('var2') ) { print "Var2 is registered<br>" ; } print "<A HREF=/work/test2.php>Secon d File</A>"; ?>
File 2: ----------------------------------------------------------------------- <?php if (session_is_reg istered('var1') ) { print "test2:Var1 is registered<br>" ; } if (session_is_reg istered('var2') ) { print "test2:Var2 is registered<br>" ; }
$var1=$_SESSION[ 'var1' ]; $var2=$_SESSION[ 'var2' ]; print "$var1 $var2 <br>"; ?>
In file test2.php neither variable is reported as a session registered variable and nothing is displayed. File /tmp/sess* has the correct contents: var1|s:11:"This should";var2|s: 12:"be displayed";
How can I establish real global variables, ones which will be visible in both files? I thought that httpd was supposed to read the sessxxxxx file, depending on the cookie received from the browser and establish those global variables. I apologize if it is a beginer question, but I was unable to answer it either through the O'Reilly book or PHP online literature. I'm at the verge of re-installing PHP 4.3.36 with shmop module enabled. -- Trust me, I know what I'm doing. (Sledge Hammer)
On Tue, 01 Jun 2004 22:17:24 -0800, StinkFinger wrote: make sure you add: session_start() ; and the top of each page that you want to access the variables in.
Thanks a lot. That was it.
--
Trust me, I know what I'm doing. (Sledge Hammer)
Regarding this well-known quote, often attributed to Mladen Gogala's famous
"Wed, 02 Jun 2004 00:49:58 -0400" speech: How can I share session registered variables between different processes? Here is my problem: File 1: ----------------------------------------------------------------------- <?php session_start() ; $var1="This should"; $var2="be displayed"; $_SESSION[ 'var1' ]=$var1; $_SESSION[ 'var2' ]=$var2; if (session_is_reg istered('var1') ) { print "Var1 is registered<br>" ; } if (session_is_reg istered('var2') ) { print "Var2 is registered<br>" ; } print "<A HREF=/work/test2.php>Secon d File</A>"; ?>
File 2: ----------------------------------------------------------------------- <?php if (session_is_reg istered('var1') ) { print "test2:Var1 is registered<br>" ; } if (session_is_reg istered('var2') ) { print "test2:Var2 is registered<br>" ; }
$var1=$_SESSION[ 'var1' ]; $var2=$_SESSION[ 'var2' ]; print "$var1 $var2 <br>"; ?>
In file test2.php neither variable is reported as a session registered variable and nothing is displayed. File /tmp/sess* has the correct contents: var1|s:11:"This should";var2|s: 12:"be displayed";
How can I establish real global variables, ones which will be visible in both files? I thought that httpd was supposed to read the sessxxxxx file, depending on the cookie received from the browser and establish those global variables. I apologize if it is a beginer question, but I was unable to answer it either through the O'Reilly book or PHP online literature. I'm at the verge of re-installing PHP 4.3.36 with shmop module enabled.
Be sure to session_start() the session in test2.php. The session_start()
function is a bit misnamed. You use it to start a new session but you also
use it to continue an old one. http://us3.php.net/manual/en/function.session-start.php
--
-- Rudy Fleminger
-- sp@mmers.and.ev il.ones.will.bo w-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Greg Bryant |
last post by:
I'm trying to extend an existing site written in CF. We're going to move
it to PHP at some point in the near future, but in the meantime, I'd like
to add some minor new features, and can steal them quickly from other sites
I have in PHP. So far, everything's cool except the session variables
holding username, userid, etc. Is there a way to "share" that session? CF
is using session.userid as a variable to store the info, but I don't seem...
|
by: Amit S. Jamgade |
last post by:
Hi All,
I am trying to share the session between classic ASP and
ASP.Net application. For session sharing I used the
method available on this link:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnaspp/html/ConvertToASPNET.asp
I would like to know if this method works in Web Farm
Scenario also.
|
by: Hardik Shah |
last post by:
Hi,
I am calling an ASP.Net page from an ASP classic application but need
the .Net page to have access to ASP classic's session variables. I am
using HTTPWebRequest to call ASP classic page which could then return
the session values. But the values are always blank. If I do a
Response.Redirect() to call the ASP page, it returns the values okay.
But I cannot do a Response.Redirect() as I just need to access some
session variables and...
|
by: Cowboy \(Gregory A. Beamer\) |
last post by:
Background:
-------------
The idea started as a single sign on type of application. Having tested it
before, I knew we could institute single sign on using the same
Authentication Cookie name (in this case "AuthenticationCookie" -- yeah,
original, I know) and the same machine keys for the applications.
<authentication mode="Forms">
<forms name="AuthenticationCookie" path="/"
loginUrl="login.aspx" protection="All" timeout="10" />
|
by: grooby |
last post by:
I would like to develop an asp.net Web application using muliple web projects under one solution file and share the session information between web applications( or projects). Is this possible?
| |
by: Selden McCabe |
last post by:
I have an old ASP project, and I'm adding some functionality in ASP.Net.
I stuff some information into Session variables in the ASP page, then
redirect to the ASP.Net page.
But when I pull up the session variables, they are empty!
Is it possible to share session variables this way?
Thanks,
|
by: W Akthar |
last post by:
Hi,
I need to pass session state variables across different
web applications. Firstly is this possible and secondly
can someone show me how please??
|
by: Guy |
last post by:
Is there a way to prevent new browsers windows from sharing session
variables with the original window?
Our team has an ASP.Net app that lets users analyze portfolio risk
given certain portfolio constructions. The set weights to certain
asset types, hit calculate and see some results. Our problem is that
users want to compare different situations side by side. So they
either hit CTRL+N or Choose "File, New" launch a new browser window,...
|
by: abcd |
last post by:
I have an ASP application. It instantiaties some COM components and we put
those COM components in Session variables...COM components have license
restrictions...We have written new ASPX page ( for better GUI and faster
development) and we will be using that ASPX page along with our ASP
application...how can I pass that Session variable (which holds COM
instance) to ASPX page so that I will be working on same instance and will
not consume...
|
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: 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: 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: 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();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |