hatrickpatrick Posted August 28, 2007 Share Posted August 28, 2007 Strange problem... It seems that if I have a variable, say "board=9" in the URL, the file in question, (say threads.php?board=9) can use it as $board jusrt fine, but if that file, threads.php, includes header.inc.php, the header file has to cll it as $_GET['board'], $board isn't set... Is there a way to set this so the included files can also use the GET variable names, or will I have to just rewrite all my code which has this problem? ??? Quote Link to comment https://forums.phpfreaks.com/topic/67132-whatd-the-setting-for-using-get-variables-without-the-_get-part/ Share on other sites More sharing options...
Jessica Posted August 28, 2007 Share Posted August 28, 2007 Okay most of that doesn't make sense. But you NEED to use $_GET[] and sanitize your user input or you're opening yourself up to security issues. Quote Link to comment https://forums.phpfreaks.com/topic/67132-whatd-the-setting-for-using-get-variables-without-the-_get-part/#findComment-336685 Share on other sites More sharing options...
matthewhaworth Posted August 29, 2007 Share Posted August 29, 2007 Strange problem... It seems that if I have a variable, say "board=9" in the URL, the file in question, (say threads.php?board=9) can use it as $board jusrt fine, but if that file, threads.php, includes header.inc.php, the header file has to cll it as $_GET['board'], $board isn't set... Is there a way to set this so the included files can also use the GET variable names, or will I have to just rewrite all my code which has this problem? ??? You mean the $_GET[] superglobal isn't visible to included files? Quote Link to comment https://forums.phpfreaks.com/topic/67132-whatd-the-setting-for-using-get-variables-without-the-_get-part/#findComment-336792 Share on other sites More sharing options...
Fadion Posted August 29, 2007 Share Posted August 29, 2007 If variables are set without calling the get superglobal then u have register_globals on. Dont know whats the problem with included file as dont know how's your script written. If u have access to php.ini or a custom one in shared hosting, just turn it off as it will cause more problems then resolve. Better call it with $_GET and ure sure for your variables. EDIT: From the php manual: It's preferred to use superglobals, rather than relying upon register_globals being on. Quote Link to comment https://forums.phpfreaks.com/topic/67132-whatd-the-setting-for-using-get-variables-without-the-_get-part/#findComment-336799 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.