Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
First some background: I'm working on a non-threads related article system that I use on my own site and am doing quite extensive extensions at the moment. It can be found on sourceforge.

The current released version doesn't work with register globals set to off, but while making the next version I thought I'd try to make it work with that option since I'm doing a lot of changes anyway.

Now, to my question. Since the scripts work with register globals on I want to go the easy way and use a function to read the values that are used in the script. But I don't want to read all values, since it wouldn't increase security. So I wrote the following function:
code:

function getCGIVars($vars) {
$cgivars = Array();
while (list($key, $var) = each($vars)) {
$cgivars[$var] = $_GET[$var];
if ($_POST[$var]) $cgivars[$var] = $_POST[$var];
}

return $cgivars;
}



What it does is take an array with the names of all values that should be read and returns an array with those GET or POST values. If there are both GET and POST values of the same name, the value of the POST will be used. After calling this function with the wanted values, I only have to use extract() on the returned array to get those values in the script.

Can anyone think of any security issues with this function? Using it, I can decide which values to read in each script without having to add a line for each.

Sponsored Links
Entire Thread
Subject Posted By Posted
Register globals off, want input Gardener 10/24/2002 10:51 AM
Re: Register globals off, want input Dave_L_dup1 10/24/2002 11:15 AM
Re: Register globals off, want input Gardener 10/24/2002 11:23 AM
Re: Register globals off, want input Dave_L_dup1 10/24/2002 2:10 PM
Re: Register globals off, want input Gardener 10/24/2002 2:27 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 254
Joined: January 2000
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)