0

I'm not sure if this is expected behavior. But if I host the following on my server

<?php
print $stackoverflow; 
?>

And I have another example.html which contains:

<form action="http://pinguincyb.org/roc/opdracht1/lawl.php" method="POST">
 <input type="text" name="stackoverflow" value="example">
 <input type="submit" value="Submit">
</form>

The page prints 'example', is this normal behavior? Shouldn't that data be unavailable until I would do something like

$stackoverflow = $_GET["stackoverflow"];
2
  • mehtod ? just to be precise... Commented Apr 5, 2013 at 11:53
  • us.php.net/manual/en/security.globals.php Commented Apr 5, 2013 at 11:54

3 Answers 3

6

It's old deprecated feature PHP called register globals. Even removed.

YOU SHOULD AVOID IT.

Read manual about Using Register Globals

If you have it you must disable it. You can do it in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the answer, it was driving me crazy.
0

This feature is old and deprecated. Avoid using it as it is unsecure

2 Comments

Yes, I actualy thought it would be a possible security issue, which is why i asked. Though I can't just turn it off, I'll bug my hoster about the config.
sectus and I aswered almost the same time
0

On security.

As a matter of fact, for the well-written application it doesn't matter if this setting turned on or off.

A well-written application have to define all it's variables before use. If this rule followed, no register_globals will be able to do any harm.

If you have something like

$admin = FALSE;
if (check_admin()) {
    $admin = TRUE;
}

noone will be able to become admin with silly

/index.php?admin=1

even if register_globals is on.

Though one have to define ther variables anyway, just for the program's consistency.

That's the point.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.