Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

PHP: regsiter_globals value

Status
Not open for further replies.

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
Is there a way to locally change the value of register_globals in your PHP code at runtime? For example, if the webhost has regsiter_globals set to off, but I want it on for my script, how do I set that in the code?

Is it in one of the SuperGlobals? I cannot find it nor can I find how to do this.

Thanks in advance from a PHP rookie.

-Bob
 

samscripts

Level 4
Legacy Platinum Member
Joined
Nov 2, 2002
Messages
180
Reaction score
0
You can't change it at runtime, but you might be able to set it on a per-directory basis with a .htaccess file.

I think you'd put something like:

php_value register_globals 1

in your .htaccess file

Read the comments at www.php.net/ini_set for more info,

An alternative is to use the extract() function on the $_REQUEST variable - eg. extract($_REQUEST). It might do what you need.

Hope this helps, :)

Sam
 

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
Thanks Sam. Guess I should probably go back and do it correctly (i.e. $_POST).

-Bob
 

.com.net.org

Level 8
Legacy Platinum Member
Joined
Oct 20, 2002
Messages
1,951
Reaction score
0
It's best practice to use $_POST or $_GET instead of just $variable.
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 1) View details

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members Online

Premium Members

Upcoming events

Latest Listings

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators

Top Bottom