Jump to content

setting register_globals to on for one website only


brianstorm

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
Link to comment
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.
Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.