I need help with my login system. In my project, when a user logs in, they just go to their account. If they look at some pages and ask to log in, they should redirect to this page after logging in, and not on the page of their profile.
Here is the code I'm trying to do for this, but the user is always redirected to student_account.php, and not to the requested page.
$fetch = mysql_fetch_assoc($exec); $_SESSION['login'] = $fetch[uniq]; $_SESSION['emailid'] = $fetch['email']; $emailid = $_SESSION['emailid']; $_SESSION['type'] = 'student'; if(isset($_SESSION['url'])) $url = $_SESSION['url']; // holds url for last page visited. else $url = "student_account.php"; // default page for header("Location:$url");
source share