473,811 Members | 3,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a simple clarification about $_SESSION

If I define
$_SESSION['x']=5;

and later, use $x say, as,

$y = $x * $x;

will it work only if register_global s is set to On?

Am i correct in saying that usage of $x in place of $_SESSION['x'] will
not work if register_global s is Off?

TIA,
Regards,
Joseph S.

Sep 25 '05 #1
1 1122
Joseph S. wrote:
Am i correct in saying that usage of $x in place of $_SESSION['x'] will
not work if register_global s is Off?


You are.

Of course, you could just add this line to your code:

$x = $_SESSION['x'];

and then you can use $x in place of $_SESSION['x'].

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Sep 25 '05 #2

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

Similar topics

3
1553
by: Info 3000 | last post by:
Hi there, Sorry for this beginner's question, but it's a real problem for me... Who can tell me why the variable Foo in this page ... : ---------------------------------- <? session_start(); ?>
0
2490
by: Phil Powell | last post by:
What is the most standardized method of utilizing the CURL functions in PHP (version 4.3.2) to be able to retrieve the contents of a remote URL that happens to be dependent upon $_SESSION for its content display? I've tried the following class methods for display and I have most everything working until I get to a URL that requires $_SESSION: class Timer extends View {
3
2228
by: Frank | last post by:
I created a php page that will create a session for a user. My problem is that once they are logged in, I dont know how to send them to the secure page. I dont know where to place the following lines of code: (also not sure where on the server the pages are placed) header("Location: http://www.mysite.com/index.html"); exit; Original code------------------------------------------------- <?
4
1556
by: Joseph S. | last post by:
Hi everyone, Managing sessions and cookies looks simple if you go by the varied tutorials on the web. But I have a few questions about real multiuser issues which i could not get any tutorials on: 1)say, I have a page doesalot.php on http://www.mysite.com/ which will be accessed by say 50 users at a time. Then, my session id checking script must run 50 instances, one for each user and the appropriate database table must, at the end of...
21
3078
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different computers (running different browsers, logged in as different users, etc.). My web site keeps track of users logged in through the use of $_SESSION. Here's the bizarre thing: All computers are logged off, then I log into my web site with one...
12
41199
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: ...
1
2568
by: Jankie | last post by:
I was reading one of the past thread supported by Pbmods.And as always contributing with excellence,he recommended this code for session management foreach($_POST as $key => $val) $_SESSION = $val; This translates all POST variables into the Session one.
4
2053
by: Pseudonyme | last post by:
Dear Sirs and Madams, Receive as information that storing a MYSQL result under $_SESSION was accelerating web page displays processes ? Absolutly needed but impossible to get this working ! I try, but do not succeed in implement $_SESSION with MYSQL. <?php session_start();
1
1485
by: Andrew | last post by:
I'm learning PHP so this might be a simple question to more expeienced developers hopefully. I have a findrecords.php page which has the following code which creates a new record in a database table if this is the first time the user performs a search: // Web Session tracking if (isset ($_SESSION)) { // nothing - we don't want to add a new record if this is set
0
9727
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
9605
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
10647
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...
0
10386
jinu1996
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...
1
10398
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
9204
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...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
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.