Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Creating a login to sub webpages based on groups??

Links for php scripts

Moderators: macek, egami, gesf

Creating a login to sub webpages based on groups??

Postby chris122380 » Mon Jun 25, 2012 12:48 pm

I have found a few scripts and or methods for creating a PHP login. The problem being is that the login goes to one page like a members page. I would like a login that goes to different pages based on a group they might belong to. So if your a tech you go to the tech page, if your a business man you go to the business page, or if your HR you go to the HR page. Is there a script or is there a easy way to set this up as I am new to PHP? (I do know how to setup a mysql database. )
chris122380
New php-forum User
New php-forum User
 
Posts: 30
Joined: Mon Jun 25, 2012 12:41 pm

Re: Creating a login to sub webpages based on groups??

Postby Nullsig » Tue Jun 26, 2012 5:00 am

You need to have that "group" defined in their user profile in the database. Then you can use a switch or if/else block to redirect based on the user's group after validating their login.

Code: Select all
if($group == 'tech'){
     header("Location: techIndex.php");
     exit();
}elseif($group == 'HR'){
     header("Location: HRIndex.php");
     exit();
}else....

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: Creating a login to sub webpages based on groups??

Postby chris122380 » Tue Jun 26, 2012 10:20 am

Ok I had a login sight but wasn't using sessions and I have been looking for a good example I have tried http://www.freetutorialsrock.com/forum/viewtopic.php?f=9&t=4&p=142#p142 and several other ones by googling but they don't seem to have good notes to know what is going on. The one with the link above I had a error as can be seen by my post (Chris122380). Any ideas on a good documented login to use with my if..then statement?
chris122380
New php-forum User
New php-forum User
 
Posts: 30
Joined: Mon Jun 25, 2012 12:41 pm


Return to PHP Scripts

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron