Back to last page after login success
Can you pls guide me for below situation.
I have created my login page by using MySQLi login user (not using the security assist) and after a successfull login I need to push back the user to his last page from where he came from, like he clicked to acces the login page from a page called index.php or sometime hadith.php and once the user login is success then the user should back to the respected page automatically.
I can grab the users present url location by
echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
but can't figure out how to push user back to the grabd location.
I figured it out how to do this which as below on the index.php page;
<a href="/user/login.php?accesscheck=<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>"</a>
And on the login.php page added as below
<?php require_once('../webassist/security_assist/helper_php.php'); ?>
$_SESSION['WA_FAIL_login'] = $_GET['accesscheck'];