Global Variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fernandomaciel
Forum Newbie
Posts: 7
Joined: Mon Jun 07, 2004 3:06 pm

Global Variables

Post by fernandomaciel »

I'm not used to the newest version of PHP, 'cause I haven't been programming for a long time. Now that I'm back I discovered that I cannot use global variables (not sure if that is entirely true). Somebody told me that I can sway that situation. If you can help me out, I'd be really thankful for the project that I'm working with is entirely done with global variables and I'm not too eager to completely change my code.

Thank you all,
Fernnando Maciel
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

in you php.ini file you can set regester_globals to on but this is default off because its not very secure
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

you can also do it via .htaccess if you do not have access to your php.ini
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

or just use

Code: Select all

$_REQUEST['variable'];
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

It will only take you like 10mins to do a search and replace on all GET/POST/COOKIE/SESSION
User avatar
Dark-Rival
Forum Newbie
Posts: 21
Joined: Thu Apr 15, 2004 5:03 am
Location: Amsterdam

Post by Dark-Rival »

Well that depends on the number of scripts he has to change then :)
Post Reply