Jump to content

registerglobal=on


tommie

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
Link to comment
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.
Link to comment
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.
Link to comment
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.
Link to comment
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
Link to comment
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?
Link to comment
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
Link to comment
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/).
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.