Hi all, ive been researching user management programs on codecanyon.net, and ive got a few programs in mind. the only issue i have is redirecting users of certain groups to a different parts of the website. is it a good idea to have them login and then have them redirect to a index page where their user group/level could then be used as a php CASE code to determine which part of the site they should go to? Thanks for your expertise!!

Member Avatar for LastMitch

@duneflyingyfz_1

is it a good idea to have them login and then have them redirect to a index page where their user group/level could then be used as a php CASE code to determine which part of the site they should go to?

It's is weird question! OK, here is a link with a diagram:

http://www.phpf1.com/tutorial/php-switch-case.html

to me I don't feel it's going to work. But if you feel you like example of the diagram and you want that then do it.

Can you at least show or post a code that show the login that redirect the page?

In the database each user should have a group number (or you should have some other mechanism in place to distinguish groups). Then on the login page you redirect a user to the page for his group using using switch statement and header('location:mygroup.php').

switch($userGroup) {

    case 1:
        header('location:group1.php');
        break;

    case 2:
        header('location:group2.php');
        break;

    ....

    default:
        header('location:logout.php');
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.