Jump to content

Recommended Posts

Previous versions of PHP (older than v5) had registar_globals turned on in the php.ini file, but since php5 they are disabled by default and the word is out that starting php6, php will no longer support registar_globals.

 

If you don't know what registar_globals are, here is my take on it:

If registar_globals is turned on php creates (registers) a variable for everything in the globals array ($_POST,$_GET,$_SERVER...). Basically, if you have something like $_POST['myFile'] php will create a $myFile variable for you that holds the same value as $_POST['myFile'] (Same goes for $_SERVER['php_self'] and the others that you mentioned).

 

Now the reason for php to remove/disable registar_globals:

Lets say that I check my login using the variable $isLoggedIn. The variable is set to 1 when I enter the corrrect username and password and set to 0 if I don't enter the correct username and password. This variable is then used to determine what I can access (e.g. if($isLoggedIn==1){//Do something} else {//Go back to login page}). Now if registar_globals is turned on and I am aware that the code uses the $isLoggedIn variable to manage access, I don't need to have the specific username and password to login. Instead I can just call the variable in the url and have it established (e.g. http://mysite.com/login.php?isLoggedIn=1). Now I have access to everything without logging in.

 

 

Note: there are ways to prevent people from "hacking" into your website even when registar_globals are turned on, but it requires more work.

 

 

Let me know if you need more explanation,

Saf

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.