Jump to content

Archived

This topic is now archived and is closed to further replies.

brianstorm

setting register_globals to on for one website only

Recommended Posts

Hi,

I'm not sure if this is a php, or operating system question, but I'm hoping someone can help. I have a CentOS4 box with php 4.3.9-3.15 running on it and I want to transfer a shopping cart from another server which requires register_globals set to on (It is currently off). The cart has too many mods to consider a full reinstall at this moment. Is it possible to set register_globals to on for 1 virtual site or would I need to reinstall php with it onto get my site working?


Any help much apprecciated.

Regards


Brian

Share this post


Link to post
Share on other sites
Register globals can be set in either the php.ini, or in a .htaccess file, so to answer your question, yes.

Share this post


Link to post
Share on other sites
but setting it on would be dumb, register globals is a severe security flaw the only reason they are like that is because they are too lazy to rewrite there damn code, I think you should find another one that didn't require this, and to make it compatible just change all teh post variables to $_POST['variable']
and get to $_GET['variable']
There is one thing you can do to make it compatible without doing anythign but inserting some code at hte top, it's a quick technique to allow you to still use it, and prevent you from touching the code
find out where all the form variables are and reinitialize those into single variables like if someone was submitting a form that had username, and password, and email then do this at the top
$username = $_POST['email'];
$password = $_POST['password'];
$email = $_POST['email'];
THa'ts it the entire form will run now with register_globals still set to off.
Do that for all get, post variables, cookies and sessions, it will run smoothly after that.
Also if you have no choice, or want to, what you do is open your php.ini file
it should open it up in word, you click find at the top.
Copy and paste the following
register_globals
THen it will have a set beside it, it will be either on or off
set it like you need it then save the document and reupload it back to the server
simple.  If you don't have access ot it, then set your editor, or whatever to open the extension .ini as a text file the same you would do with .htaccess
if it's dreamweaver open extension handler, and put in
.ini put the default editor as word, if it's frontpage(I hate frontpage), or something else, it'll do the same thing.

Share this post


Link to post
Share on other sites
[quote] open your php.ini file it should open it up in word[/quote]
Dont edit ini files with word. It creates mal formed documents. Use a plain text editor or your asking for trouble. If your stuck with windows, notepad will do.

Share this post


Link to post
Share on other sites
Create a new file called .htaccess within the direcotry your shopping cart is stored in and the following to it:
[code]php_flag register_globals On[/code]
Save the .htaccess file. Your script should now work and register_globals will be on for that script only.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.