Friday, March 28, 2014

After login redirect to clicked link in php

My friend asked how to redirect a page after login to the clicked link php.Then i did some research and found some codes for this.

Lets have a look this tutorial.

$_SESSION['redirect_to'] = $_SERVER['REQUEST_URI'];
header("Location: login.php?action=login");
exit();

// On successful login
$redirect = $_SESSION['redirect_to'];
// unset the session var
unset($_SESSION['redirect_to']);
header("Location:$redirect");
exit();

Hope this will help

No comments:

Post a Comment