jj20051 Posted September 4, 2008 Share Posted September 4, 2008 I have this older script that uses php register globals (on) . I know it's a big deal if you use it as it's a security flaw, but is there a way to work around this flaw in the script without rewriting it again? Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/ Share on other sites More sharing options...
DarkWater Posted September 4, 2008 Share Posted September 4, 2008 Take the 15 minutes to rewrite, honestly. You CAN "simulate" register_globals, but it's really inadvisable. Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634102 Share on other sites More sharing options...
jj20051 Posted September 4, 2008 Author Share Posted September 4, 2008 It's Like 25 - 35 PHP Files. So If I Could Pay Someone or If Someone Could Write A Brief Tutorial On What To Fix That Would Be g8. Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634106 Share on other sites More sharing options...
DarkWater Posted September 4, 2008 Share Posted September 4, 2008 What kind of script is it for it to have 25-35 files? Elaborate. Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634114 Share on other sites More sharing options...
.josh Posted September 4, 2008 Share Posted September 4, 2008 If you have access to php.ini you can simply set it to on.. Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634128 Share on other sites More sharing options...
.josh Posted September 4, 2008 Share Posted September 4, 2008 oh yeah alternatively you can put php_flag register_globals on in your .htaccess file Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634129 Share on other sites More sharing options...
PFMaBiSmAd Posted September 4, 2008 Share Posted September 4, 2008 Register_globals involved magically populating same name program/post/get/cookie/session variables. Any of the following present in a script - $abc, $_POST['abc'], $_GET['abc'], $_COOKIE['abc'], $_SESSION['abc'] are all cross-populated with the same value when register_globals are on. The fix is to modify your code to convert any use of session_register, session_is_registered, session_unregister... functions to use $_SESSION and change code so that it specifically references the correct $_POST, $_GET, $_COOKIE, $_SESSION, or program variable that it is expecting a value to be in. The hard part in doing this is you need to determine how a variable is being used in any piece of code. Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634130 Share on other sites More sharing options...
DarkWater Posted September 4, 2008 Share Posted September 4, 2008 @CV: Orrrr, he could do it right and just not rely on them. =/ Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634131 Share on other sites More sharing options...
.josh Posted September 4, 2008 Share Posted September 4, 2008 @CV: Orrrr, he could do it right and just not rely on them. =/ Obviously. You gave him the warning. It's up to him whether to accept it or not. I'm not going to judge his situation. Warning him about it is enough IMO. Quote Link to comment https://forums.phpfreaks.com/topic/122796-php-register-globals-work-around/#findComment-634134 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.