iarp Posted January 16, 2009 Share Posted January 16, 2009 Is there anyway possible todo so? <?php ob_start(); session_start(); session_regenerate_id(); $errors = array(); require_once('iarp-settings.php'); require_once('includes/iarp-core-functions.php'); require_once('includes/iarp-core-classes.php'); $cms = new iarp_main(); $content = new iarp_pages(); $content->setvals($_SERVER['REQUEST_URI']); $parts = explode('?',$_SERVER['REQUEST_URI']); $p = 'themes/' . $cms->theme(); if ($_SERVER['REQUEST_URI'] == '/') { $p .= '/index.php'; } else { $p .= $parts[0]; } if (file_exists($p)) { if (!empty($parts[1])) $p .= '?' . $parts[1]; require_once($p); } else { require_once('themes/default/index.php'); } mysql_close(); ob_flush(); ?> In a nutshell the above code checks the url against files contained in the themes folder, but if someone adds ? and anything after that to any of the file names it's unable to be require()'d All i get is: Warning: main(themes/default/file.php?uid=1) [function.main]: failed to open stream: No such file or directory in /homepages/31/d204952132/htdocs/iarp/main/iarp-load.php on line 29 Fatal error: main() [function.require]: Failed opening required 'themes/default/file.php?uid=1' (include_path='.:/usr/lib/php') in /homepages/31/d204952132/htdocs/iarp/main/iarp-load.php on line 29 Quote Link to comment https://forums.phpfreaks.com/topic/141036-solved-passing-get-data-through-require/ Share on other sites More sharing options...
corbin Posted January 16, 2009 Share Posted January 16, 2009 $_GET is available in all files. When you require or include a file, you give it a file path. ?blah= is a format from the HTTP protocol that is invalid in a file system. Quote Link to comment https://forums.phpfreaks.com/topic/141036-solved-passing-get-data-through-require/#findComment-738174 Share on other sites More sharing options...
Zephyr_Pure Posted January 16, 2009 Share Posted January 16, 2009 I'm thinking that there's a server var called "QUERY_STRING" that would hold your GET vars after the ?. Also, taking the basename() of the REQUEST_URI should give you the filename. Maybe you have to pass the query string on to the requested URI by setting it? If all else fails, you could just use cURL to retrieve the page and dump the response in your handler page. Quote Link to comment https://forums.phpfreaks.com/topic/141036-solved-passing-get-data-through-require/#findComment-738175 Share on other sites More sharing options...
iarp Posted January 16, 2009 Author Share Posted January 16, 2009 After reading Zephyr_Pure reply i realized the way i have it setup the $parts array would be accessible within the requested file. And then just carried on with normal operations. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/141036-solved-passing-get-data-through-require/#findComment-738178 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.