Jump to content

Archived

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

tommie

registerglobal=on

Recommended Posts

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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
.... you have made no indication that you restarted the webserver after you made the php.ini change.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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..:/

Share this post


Link to post
Share on other sites
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:
[code]; to possible security problems, if the code is not very well thought of.[/code]
That is around line 456, However this maybe different for you. After that is where you change the register_gloabls setting.

Share this post


Link to post
Share on other sites
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...:/

Share this post


Link to post
Share on other sites
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:
[code]php_flag register_globals On[/code]
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.

Share this post


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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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
[code]php_flag register_globals On [/code] but nothing changed. so dont i have to implement it or something?

Share this post


Link to post
Share on other sites
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:
[code]<form action=index2.php method=post>
<input type=text name=variable>
<input type=submit value="Logga In">
</form>[/code]

page2
[code]<?
echo $variable;
?>[/code]

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

Share this post


Link to post
Share on other sites
[quote author=tommie link=topic=109057.msg439552#msg439552 date=1158948273]
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
[code]php_flag register_globals On [/code] but nothing changed. so dont i have to implement it or something?
[/quote]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 [b]File > Save As...[/b] type the following exactly into the Filename box [b]".htaccess"[/b] including the quotes. Click save. The htaccess file has now been created. Now move the htaccess file to the htdocs folder (xampp/htdocs/).

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.