I have a login form with a redirect to a menu page in the same directory that will link to other files in the same directory that are all shared by all the users in the database.
session_start();
$_SESSION['username'] = $username;
$_SESSION['password'] = $hash;
header("location:loginSuccess.php");
This works fine because loginSuccess.php is in the same directory as the login form.
But now I need the redirect to a particular sub-folder, depending on which user logged in. In other words, if user1 logs in, I want to redirect this user to /user1.loginSuccess.php, and if user2 logs in, I want to redirect this user to /user2/loginSuccess.php.
I tried the following:
header("location:/"<?php echo $username ?>"/loginSuccess.php");
I understand that this would translate to /user1/loginSuccess.php if user1 logged in, but got a message with an unexpected ? on line 43, which is the line with the above code.
I am self-taught in procedural php but relatively unfamiliar with object orientated php.
Any help and advise will be greatly appreciated!