PHP
PHP : Redirect user back to LoggedIn page after logging in
Login To Post Your Comment
3 comments
Thanks for guidance, posting my code as an example.
So we reuse isSubmit below like that after setting to true upon button submit.
$_SESSION["isSubmit"] = true;
session_start();
if (isset($_SESSION['isSubmit'])) { # Check if user has already submit form, and redirect back to output.php if already logged in
header("Location: " . SITE_URL . "output.php");
exit();
}
Manfred Lim
4 years agoHi Victor,
Can you show me what your code is like in screenshot or in text so I can further assist from there?
Session is exactly the same concept as cookies. Just that you have to remember to start_session(); before doing it. And once browser is closed session is always cleared. So if once the user close the browser, they should end up back to login page if they go back to the webpage.
Session is exactly the same concept as cookies. Just that you have to remember to start_session(); before doing it. And once browser is closed session is always cleared. So if once the user close the browser, they should end up back to login page if they go back to the webpage.