Jump to content


Photo

setting register_globals to on for one website only


  • Please log in to reply
6 replies to this topic

#1 brianstorm

brianstorm
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 19 July 2006 - 02:21 PM

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

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 19 July 2006 - 02:31 PM

Register globals can be set in either the php.ini, or in a .htaccess file, so to answer your question, yes.

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 July 2006 - 02:39 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 19 July 2006 - 02:54 PM

open your php.ini file it should open it up in word

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.

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 July 2006 - 03:04 PM

I know I said notepad up there.  .txt is notepad

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 19 July 2006 - 05:40 PM

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

#7 brianstorm

brianstorm
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 24 July 2006 - 12:18 PM

thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users