I'm having issues passing on multiple $_GET variables with "next".
I'm redirecting users to the login page:
login?next=initial_page?email=john_doe@gmail.com&activate_key=1421sdxz开发者_高级运维cxz213xz
The problem is that the activation key is treated as a second $_GET parameter on the login page (along with "next"), instead of being part of the redirected $_GET.
A solution would be to use cookies, is there any way I can still make this work with $_GET though? 
Thanks!
You need to use urlencode to encode the parameter data--something like this:
echo '<a href="login?next=' . urlencode('initial_page?email=john_doe@gmail.com&activate_key=1421sdxzcxz213xz') . '">link</a>';
This will produce a link like this:
<a href="login?next=initial_page%3Femail%3Djohn_doe%40gmail.com%26activate_key%3D1421sdxzcxz213xz">link</a>
...which will be interpreted correctly.
You can URL-encode the & as %26.
login?next=initial_page?email=john_doe@gmail.com&activate_key&1421sdxzcxz213xz
Try this:
header('Location: login?next='.rawurlencode('initial_page?email=john_doe@gmail.com&activate_key=1421sdxzcxz213xz'));
which automatically generates a 302 response.
Test code:
<?php
if (isset($_GET['next']))
    print $_GET['next'];
else
    header('Location: '.$_SERVER['REQUEST_URI'].'?next='.rawurlencode('initial_page?email=john_doe@gmail.com&activate_key=1421sdxzcxz213xz'));
?>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论