Jump to content

User login directed to specific page


Kay1021

Recommended Posts

Hi

 

I was wondering if anyone knew of any site that could help me. I am looking to create a secure site where at the beginning the user is prompted to enter a username and password there is 1 admin and then say 8 users. When each user has entered the correct information they are taken to a page specifically for them...and they are not allowed access into any of the other 7 users' pages. However the one admin can view all 8 pages.

 

I'm just wondering if anyone could guide me. Even if you've got a tutorial that does this sort thing or how i could modify one....i'm just kinda stuck.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/159586-user-login-directed-to-specific-page/
Share on other sites

So the pages and users are linked using a one-to-one relationship. You just do this:

 

if ($user['is_admin'] || $page['user_id'] == $user['user_id']) {
echo "what's up?";
}
else {
echo 'gtfo';
}

 

Assuming your page comes from the database, your page table would have a field called user_id which references a user in the users table.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.