Garcia Posted January 15, 2007 Share Posted January 15, 2007 Here is what I am trying to accomplish.I set up an example page for groups.-Displays an error for guests.-Display an error for members who are not an admin (group 3).I set up a table for members and a field called gid which is its group id. I set up a table for groups which have the groups and the id.Now to protect a page for admins only I tried this:[code]<?phpsession_start();header("Cache-control: no-cache");if($_SESSION['auth']) {print "Welcome Member!";}else {print "Welcome Guest!";}if($_SESSION['gid'] == 3{print "Part of Admin Group";}else {print "Not part of admin group";}?>[/code]That didn't work it did print Welcome Member but for everyone it including guests it did say Part of Admin Group. I am trying to accomplish user group protected pages, but not sure how to set it up properly. I may need to create a permissions table but not sure what to add with that.Any help including code snippets or tutorials would be very appreciated.Regards, Link to comment https://forums.phpfreaks.com/topic/34319-groups/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.