1
$return_url = $_SERVER['REQUEST_URI'];
header("Location: /logout?msg=You must login to view that page&c=2&path=$return_url");

For some reason its taking me to http://my.domain/login?msg=You%20must%20login%20to%20view%20that%20page&c=2

when it should take me to

to http://my.domain/login?msg=You%20must%20login%20to%20view%20that%20page&c=2&path=/blogs/write

if i echo $return_url it returns the right path...

So i'm not sure whats up. Help?

0

1 Answer 1

4

You need to use the urlencode function like so:

header("Location: /logout?msg=".urlencode("You must login to view that page")."&c=2&path=".urlencode($return_url);

In addition, it seems like your logout page is also redirecting to /login. View the sequence of requests which occur using an HTTP Proxy such as Fiddler.

Sign up to request clarification or add additional context in comments.

2 Comments

@Keverw Also, include the HTTP response headers you see when you hit the page that includes your php code.
Thanks! I got it... I feel stupid. logout.php went to login.php but i didn't have it carry over the path variable. My own fault. You get best answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.