I made a dummy website where I store some data
in the session Storage
and change features
of the interface based on that. I know this is not secure
at all, so I am curious how that is done in real life ?
Here is a snippet of my code so you can get an idea
of what´s about. I am using PHP
on the server side
. Would it be the way to go with PHP $_SESSION
in this scenario ?
function sessionUser() {
// for ADMIN view
if ( sessionStorage.getItem( 'role' ) == "admin" ) {
showWelcomeMessage();
showAdminInterface();
getProductData();
getUserData();
getSubscriberData();
}
// for USER view
if (sessionStorage.getItem( 'role' ) == "user" ) {
showWelcomeMessage();
showUserInterface();
getProductData();
}
}