skania Posted February 24, 2014 Share Posted February 24, 2014 So I have a tedious status selection bar that is on every page, so I simply used an include on the pages, the actual navigation bar separated. The navigation is ~/public_html/courseListMenu.php When the user is on a certain page, it will simply refresh the page to the current page, which the updated status (courseID), and the information about that course. However, if the user is looking at a participant, and clicks on the navigation (ie, change the courseID, thus changing the catalog of people in it), I want to redirect to the index.php. So here is the problem: I have a URL, www.example.com/atn/index.php *A class is selected* New URL with updated page, www.example.com/atn/index.php?CRN=999999999 Select editparticipant, www.example.com/atn/editparty.php?CRN=999999999&PARTY=111111111 *A new class is selected* I need to extract "editparty.php" so I can compare the string and if they match, then revert the user back to index.php. I need to compare strings, because since this is an include, there will be other pages that will redirect the user to index.php The exact problem I have is that I can get the script that is running, but it is the INCLUDED script filename, not the file name it is INCLUDED on, which is the filename I need. I hope this is clear; if it isn't, I can try to explain a little better. If anyone has any idea on how I can get this, it would be very much appreciated! Link to comment https://forums.phpfreaks.com/topic/286494-get-current-page-from-an-included-php-script/ Share on other sites More sharing options...
.josh Posted February 24, 2014 Share Posted February 24, 2014 test.php <?php echo "from test.php"; print_r($_SERVER); include('test2.php'); ?> test2.php <?php echo "from test2.php"; print_r($_SERVER); ?> both print_r($_SERVER) will show: Array ( [SCRIPT_FILENAME] => /path/to/script/test.php [REQUEST_URI] => /test.php [SCRIPT_NAME] => /test.php [PHP_SELF] => /test.php ) Link to comment https://forums.phpfreaks.com/topic/286494-get-current-page-from-an-included-php-script/#findComment-1470524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.