473,569 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tip about register globals set to "on"

I did some coding on a site where register_global s is set to on. The
problem I encountered was that the session variable changed without my
changing it explicitly. I knew that in register globals being on, that
all the variables were global variables. What I didn't realize was that
it set up an equivalence such that the variable is an alias for the
session variable with the key name of that variable. That is,
$_SESSION['key'] is the same as $key.

I got around the problem by changing the key of the the session variable
to something unique.

Here is a little test script:
<?php
session_start() ;
$_SESSION['company'] = 'This';
print '1: ' . $_SESSION['company'] . '<br>';
$company = 0;
print '2: ' . $_SESSION['company'] . '<br>';
$_SESSION['company'] = 'This';
print '3: ' . $_SESSION['company'] . '<br>';
$company = 'That';
print '4: ' . $_SESSION['company'];
$foo = 'Foo';
print '5: ' . $_SESSION['foo'] . '<br>';
?>

Here is the output:
1: This
2: 0
3: This
4: That
5: Foo
Oct 12 '08 #1
2 1717
What's the question?

I would recommend against using register_global s anyway. The directive
is deprecated and due for removal as of PHP 6 as it has security
vulnerabilities .

Oct 12 '08 #2
macca wrote:
What's the question?
Read the subject title! I am passing on a little personal experience,
and not asking a question.
>
I would recommend against using register_global s anyway. The directive
I agree totally, however it is not always under our control to make that
decision. Many places will not change because it would break too many
existing applications.
is deprecated and due for removal as of PHP 6 as it has security
vulnerabilities .
.....and that might hinder acceptance of PHP 6 if it will force turning
it off. That is for the reason I gave above.
>
Oct 12 '08 #3

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

Similar topics

20
11642
by: Chris Krasnichuk | last post by:
hello, Does anyone know how I make php work on "my" computer? I made a mistake in my last post so I fixed it here. Chris
0
1790
by: Justin | last post by:
Hi. I decided to tidy up some of my queries, but I came across something that stumpt me: mysql> SELECT -> jobs.jobId, -> jobs.active, -> jobs.title, -> jobs.listed, -> industries.industry, -> occupations.occupation,
0
1346
by: Cave | last post by:
Is there a way to install the SQL Reporting Services Client on Whidbey ? The installer searches the system for an installation of Visual Studio 2003 in order to install the client part of SQL RPS. Although there is an installation of the Visual Studio Whidbey I cannot install the client of SQL RPS on it. Any ideas ??? thanksalot
0
1605
by: Kevin Schneider | last post by:
Please forgive me if this is a bit off topic, but I haven't had any takers in other forums. With ASP.NET projects, is it possible to have VS.NET automatically change the configuration options of the "Copy Project" dialog box based on the value selected in the "Solution Configurations" drop down list? I'd like to set up the project that...
0
1194
by: madmanpierre | last post by:
I have a Mobile Pocket PC app written in .NET, I notice that Explorer and other programs, when running, show up on the Start menu right below Start and right above Today in a list of icons on that line. My .NET app doesn't show up automatically, so I am wondering how I can get it to show up in that quick pick list (my term) area.
2
1863
by: John Smith | last post by:
I have more than 4,000 pieces of email in my Yahoo account. I would like to write a program to download them all. In order to write such a program, I need to know a few things. 1. After I fill out userid, password, and click on "login", what exactly is sent to Yahoo? 2. When I click on "next" to fetch the next mail, what exactly is sent...
7
2553
by: Aaron G via AccessMonster.com | last post by:
Wanted to share a solution to something which I didn't find on the net: EVERY form in my Microsoft Access 2002 database gave an error any time any code was to be called: form OnOpen, button OnClick, etc. Error was: <b>The expression On Open you entered as the event property setting produced the following error: Expecteed: end of...
1
1475
by: Todd | last post by:
I was wondering if someone has had a similar situation. We have a legacy VB6 application that is fairly large. We'd like to write new code in C# and have it launched from the VB6 application so it looks, at least, like a child module. We looked at seeing if we could host a C# control as an ActiveX control and found that wouldn't work and it...
3
4453
Curtis Rutland
by: Curtis Rutland | last post by:
OK, I have a question. I have a problem. I'm trying to catch all KeyDown events on a button, but the problem is when I press the "Enter" key, the button's "Click" event is triggered, not the "KeyDown" event. Or if it is, it isn't being caught by the handler. Is there a way to disable the button being clicked by pushing Enter?
0
7615
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...
0
7924
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. ...
0
8130
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...
1
7677
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...
0
6284
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...
1
5514
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...
0
5219
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...
0
3653
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...
1
2115
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 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.