brianstorm Posted July 19, 2006 Share Posted July 19, 2006 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.RegardsBrian Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/ Share on other sites More sharing options...
trq Posted July 19, 2006 Share Posted July 19, 2006 Register globals can be set in either the php.ini, or in a .htaccess file, so to answer your question, yes. Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/#findComment-60481 Share on other sites More sharing options...
Ninjakreborn Posted July 19, 2006 Share Posted July 19, 2006 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 codefind 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 fileit should open it up in word, you click find at the top.Copy and paste the followingregister_globalsTHen it will have a set beside it, it will be either on or offset it like you need it then save the document and reupload it back to the serversimple. 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 .htaccessif 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. Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/#findComment-60484 Share on other sites More sharing options...
trq Posted July 19, 2006 Share Posted July 19, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/#findComment-60492 Share on other sites More sharing options...
Ninjakreborn Posted July 19, 2006 Share Posted July 19, 2006 I know I said notepad up there. .txt is notepad Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/#findComment-60497 Share on other sites More sharing options...
wildteen88 Posted July 19, 2006 Share Posted July 19, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/#findComment-60570 Share on other sites More sharing options...
brianstorm Posted July 24, 2006 Author Share Posted July 24, 2006 thanks! Quote Link to comment https://forums.phpfreaks.com/topic/15039-setting-register_globals-to-on-for-one-website-only/#findComment-62769 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.