PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Return Back After Login Using PHP

Go down

Return Back After Login Using PHP Empty Return Back After Login Using PHP

Post by jamied_uk 29th November 2022, 19:33

# Return Back After Login!


in login page put this inside the login form

Code:
<input type="hidden" name="redirurl" value="<? echo $_SERVER['HTTP_REFERER']; ?>" />


Code:
<?php

// put this on the login page at the bottom!

if(isset($_REQUEST['redirurl']) && isset($_SESSION["username"])) {

$url=$_REQUEST['redirurl']; // holds url for last page visited.

} else {

$url="/$db_username"; // Your Default URL Here!

header("Location:$url");

}
?>
jamied_uk
jamied_uk
Admin

Posts : 2950
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum