How to send to the last page after login?

hi i do a login with slim
now after the user come in to the system how u do that the user go to the last page him come in to the login page

You could use for example session for storing last url.

u can show me how plz
with example?

Ofcourse you need to know how to use sessions properly, but simpy:

  • start session when bootstrapping your app: session_start();
  • when checking if user is logged in or not, save current url or route name to session
  • when user is logged in, check if session includes url or route name and if it does, then redirect to that

I cheated and used flash messages to store the referrer in my example app: https://gitlab.com/Antnee/slim-skeleton-php7/blob/master/App/middleware.php#L12

Flash uses sessions, so basically you did what I suggested but with some extra files and code :slight_smile:

Yep. It’s an example though :slight_smile:

I didn’t understand do II put that in the auth.php ?

Do you have an code example? And where do I put it?

I’m not sure what you’re asking and I don’t know what’s in your auth.php and what you’re trying to do. Would need more information to help you out.