Storing URL parameters in a PHP session variable [done]
Posted: Thu Sep 21, 2023 11:24 am
I have recently wanted to use some custom parameters passed via the login URL. I propose storing these as a PHP session variable which is created when the $_GET array is parsed in index.php. My request then is to add these three lines near line 229 in index.php (after the built-in Auto Login parameters have been assigned to variables). In my example, the password parameter would be removed from the stored array.
I realise that there are methods in both JavaScript and PHP to achieve this, but a little experimentation has convinced me this would be the simplest and most reliable solution.
Thanks
Neil
Code: Select all
$nuHome = $_GET['h'] ?? '';
// store the parameters for the duration of the session
$URLParams = $_GET;
unset($URLParams['p']); // remove the password from the array
$_SESSION['nubuilder_session_data']['URL_PARAMS'] = $URLParams;
// end of parameter storage insert
Thanks
Neil