Jump to content

etopal

New Members
  • Posts

    7
  • Joined

  • Last visited

etopal's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It surely is not the perfect solution. But seems to work for what I need 🤔 If I ever had a million users, I surely would need a better login system as well.. Might have to look into your points though.
  2. Huzzah! 🤩 I think the end solution was a very simple one, as it most of the cases seems to be: ``` <?php require('_login.php'); if ($login_user === 'User1') { header("Location: user1.php"); } else if ($login_user === 'User2') { header("Location: user2.php"); } else if ($login_user === 'User3') { header("Location: user3.php"); } else { header("Location: generalcontent.php"); } ?> ``` As a note, if anyone else ever struggles with a similar problem.
  3. I have not 🤔 (I'm not very familiar with php, just dabbling with it... ) The second redirect (to generalcontent.php) works, so I'm guessing the $_SESSION doesn't contain what I'm looking for, as it just gets skipped 😬
  4. Or another viable option would be to show content based on username: <?php session_start(); if ($_SESSION["username"]=='User1'){ ?> SHOW USER1 CONTENT HERE <?php } ?> But this has the same issue; not sure how to fetch the logged in username...
  5. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.