Answer the question
In order to leave comments, you need to log in
How can a CMS figure out which page is requested of it without using superglobals?
I have some self-written CMS in PHP, carefully obfuscated by a developer unknown to me. I want to make a CNC for her through my own script. All page requests are processed by the CMS through a single index.php - so I'll just include the script there and reprocess requests with it.
The mechanism of work is conceived as follows: my script, having a CNC conversion rule, first receives the current request url from $_SERVER['REQUEST_URI'], determines if it is a new CNC, and if it is a new CNC, then it gets the old address from the database and feeds it to CMS , replacing in accordance with it the data that the CMS is guided by when generating the page.
But how can a CMS "guess" what URL it is processing? Clearly, through superglobal variables: $_SERVER, $_GET, $_REQUEST and so on. After reviewing the contents of these arrays and replacing the values of all elements that contained a value similar to the current url, I did not achieve anything - when processing the old address understandable by CMS, even if all the url inclusions in the values of superglobal variables are spoiled, the CMS still guesses which page is needed give; when processing a new url, in which the variables are replaced with the ones corresponding to the old one, the CMS indignantly returns 404.
Therefore, the question. How can a CMS figure out which page is requested of it without using data from PHP's environment superglobals?
Answer the question
In order to leave comments, you need to log in
php.net/getenv
$_SERVER['REQUEST_URI']='bbb';
echo getenv('REQUEST_URI');
I can't imagine otherwise than through global arrays.
What about in .htaccess?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question