Jump to content

Recommended Posts

I would like to include this into all my files. Would this be a security hazard? If so,
how and what could I do to improve it?
<?php
/************************************************************/
/* If register_globals is not set then import them	    */
/* Import GET/POST/Cookie variables into the global scope   */
/************************************************************/
if (!ini_get('register_globals')) {
@import_request_variables("GPC", "");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/88758-register_global-question/
Share on other sites

There is a reason why register globals is turned off by default in PHP5 and removed in PHP6. It's bad style and opens up for a variety of security issues. Just use the superglobals.

 

I understand that, but you still haven't answered my question?

I have register_globals = Off inside of my php.ini.

 

Is import_request_variables turning register_global = On or is it

just importing them. I am trying to build a Content Management System,

so I would hate to use superglobals $_GET $_POST etc.. in each file. 

 

Thanks!

It doesn't turn it on, but it'll work like that. I strongly recommend against it though.

 

Ok, how could I improve this? How could I initialize superglobals in lets say in

include.php and include it in all of my files? I am looking for an example.

 

Thanks!

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.