Drupal 7 site, I have a custom module containing dynamic pages using query strings, such as: "page?id=123". In my code I need to parse the query string (using functions drupal_get_query_parameters, then getting the 'id' value from the returned array), I then use the 'id' value in a database query.
If a user decides to log in from that page, then after the redirection the query string changes, to something like "page?destination=page%3Fid%3D123". I can of course parse the 'destination' string to get the 'id' value? But that would involve quite some coding and I have to repeat doing this for multiple pages. I wonder if there is any better practice?