Is there a way to get current logged in username and based on that redirect to a different page?
I’m using the following secure PHP login without MySql as a login system: https://sourceforge.net/projects/phploginbyvallastech/
Now I’m looking to redirect each logged in user to their personalized page.
But I can’t figure out how to A) fetch the current logged in user and B) redirect multiple users.
This code redirects to the latter address, but the username based redirect is not working:
<?php
session_start();
if ($_SESSION["username"]==User1){
header("location: user1content.php");
exit;
} else {
header("location: generalcontent.php");
exit;
}
{ ?>
<?php } ?>
So it’s clearly not fetching the logged in user. Though <?php echo $login->username; ?>
fetches the username just fine.
I know there’s something missing, but what that might be… Have been trying different things without success.