Jump to content


Photo

registerglobal=on


  • Please log in to reply
16 replies to this topic

#1 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 12:06 PM

Hi.
I have a problem i just upgraded to php5 and now my pages dont work.
i have always used register global=on. I know that the security sucks with that but i really dont care use it bc its so easy. but now when try my pages it they dont work. when i call a variable from a form from the page before i use $variable and not $get['variable'] and i dont wanna change every page. How can i make it works again?
and of course i have register glocal=on in php.ini

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 September 2006 - 12:58 PM

Well, it's $_GET['varname'], first of all.  Secondly, you really need to change all your pages to reflect this.  If you don't it's just poor coding and insecure.

Also, if you've made the change, make sure you restart your webserver.

Info: PHP Manual


#3 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 01:29 PM

ok but if i wanna have poor coding and very unsecure page how can i make it to work agian.
plzz help me i have like 500pages dont wanna change them all.

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 September 2006 - 01:40 PM

.... you have made no indication that you restarted the webserver after you made the php.ini change.

Info: PHP Manual


#5 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 01:42 PM

ok sorry i did restart my server and my computer very many times after i chaged php.ini :)
i am a noob but not so much  lol :)

#6 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 September 2006 - 01:45 PM

Ok, well that's pretty much all that controls register_globals... so if that didn't fix it, I'm not sure what the issue is.

What webserver are you using?  And what PHP version exactly?

Info: PHP Manual


#7 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 01:48 PM

im using the latest version of xampp so:
Apache 2.2.3
PHP 5.1.6

when i used it before dont remember what version i used then it was only to turn on registerglobal and restarted the server and it worked so im kinda bummed now..:/

#8 wildteen88

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

Posted 22 September 2006 - 04:31 PM

You can still use the superglobals, eg _GET, _POST, _SESSION etc, when regsiter globals is enabled. Also make sure you are edting correct the php.ini that is located in /opt/lampp/etc/ (linux) or xampp\apache\conf (windows)

And make sure you are editing the value of register_gloabls in the correct place too in the php.ini. Make sure you are not editing anything that is after any semi-colons (;). To change the value of register globals find the following:
; to possible security problems, if the code is not very well thought of.
That is around line 456, However this maybe different for you. After that is where you change the register_gloabls setting.

#9 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 05:10 PM

ok.. cant find a php.ini in  xampp\apache\conf but in xampp\apache\bin is 1 and that one was register global=on
and in apache\php every php.ini is register global=on even the php5.ini
so im kinda confused that its not working...:/

#10 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 05:13 PM

i even changed to php4 and it didnt work dammit i dont know what to do anymore..:(

#11 wildteen88

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

Posted 22 September 2006 - 05:29 PM

Add an empty .htaccess file into the root of the htdocs folder, or whatever folder you use to store your php script. Now add the following into the .htaccess file:
php_flag register_globals On
Does youre script work now?

Also run the function phpinof() and see if register_globals is enabled under the Master Value. if its and your script doesnt work still then there is a problem with your script.

#12 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 22 September 2006 - 05:51 PM

xampp comes with register_globals enabled by default. If you disable it, their demo scripts stop working unless you modify them. I disabled register_globals and modified the demo scripts on my laptop.

The php.ini file on the laptop is in C:\Program Files\xampp\apache\bin\php.ini

Ken

#13 imartin

imartin
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 22 September 2006 - 05:56 PM

When you say "my pages dont work" you have to be more specific.  What exactly is the problem? because register globals off wasn't the only change in PHP.

What error are you getting?

#14 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 06:04 PM

ok when i run the phpinfo i got register global=off so thats my problem i just havnt changed the right php.ini but i cant find anymore lol but how exactly do i do a htaccess  file i tried and created a test.htaccess and wrote
php_flag register_globals On
but nothing changed. so dont i have to implement it or something?

#15 tommie

tommie
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 September 2006 - 07:06 PM

ok now i have found the right php.ini and changed so now phpinfo() says that register_global=on but i still cant use my scripts..

page1:
<form action=index2.php method=post>
<input type=text name=variable>
<input type=submit value="Logga In">
</form>

page2
<?
echo $variable;
?>

i cant find any errors in that code and it have always worked before


#16 imartin

imartin
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 22 September 2006 - 08:19 PM

Does index2.php return any PHP errors?  Do you have error reporting turned off?

#17 wildteen88

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

Posted 23 September 2006 - 10:34 AM

ok when i run the phpinfo i got register global=off so thats my problem i just havnt changed the right php.ini but i cant find anymore lol but how exactly do i do a htaccess  file i tried and created a test.htaccess and wrote

php_flag register_globals On
but nothing changed. so dont i have to implement it or something?

Sorry I should of explained how to create a htaccess file. The htaccess file has no name, it is just a file extension on its own. To create the htaccess file open up Notepad and type the following in to a new file:
php_flag register_globals On

Now go to File > Save As... type the following exactly into the Filename box ".htaccess" including the quotes. Click save. The htaccess file has now been created. Now move the htaccess file to the htdocs folder (xampp/htdocs/).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users