Eugene
Eugene

Reputation: 4389

Custom session handlers and redirect

I have a small app, that redirects on successful user sign in and also on app initialization it defines custom session handlers. Redirect is done this way: sprintf( '<html><head><meta http-equiv="refresh" content="%d;url=%s"/></head></html>', $delay, $url ); .

Now the question is. If I redirect this way, will it reach custom session handler during, that call?

Upvotes: 0

Views: 143

Answers (2)

Madara&#39;s Ghost
Madara&#39;s Ghost

Reputation: 174977

You're doing it wrong. Use the header() function to send a Location header like so:

<?php header("Location: $url"); ?>

Add that before any output is sent. And yes, the session will remain.

Upvotes: 1

busypeoples
busypeoples

Reputation: 737

Not sure why you are redirecting that way.

session_start();

// do something

header("Location: some_url_to_redirect");

Upvotes: 0

Related Questions