Example of page access control using groups:
Right after the include statements I grab the user's information. As follows:
<br /><br />//Snag Authentication stuff<br />$userob = new user;<br />$user = $userob -> authenticate("U_Groups");<br />$Username = $user['U_Username'];<br />$UserID = $user['U_Number'];<br /><br />
Ok got their info, now let's send the header and drop an IF... ELSE in to check the group permissions.
<br /><br />// ------------------<br />// Send a html header<br /> $html = new html;<br /><br />// Let's authenticate the user to see if they have proper group permissions to access this page<br />// If they aren't authorized, get them outta here!<br /> if (!preg_match("/$config[Permissions_Group]/", $user[U_Groups]) ) {<br /> $html -> not_right("I'm sorry, you do not have permissions to access this form. If you feel this is in error, please contact the administrator.");<br /> }<br /> else {<br /> .... send them on to the page/form whatever...<br /> }<br />
Look closely at the IF... the "Permissions_Group" is a variable you'll set in your Config Settings in the admin section.
At the bottom of the config page you can add your own variables. Add something like this:
<br />$config['Permissions_Group'] = '5';<br />
Of course group 5 is the group I'm using, just substitute your group number in there.
Hope that helps.
Attached is a screenshot of the error produced.