Restrict access to current members

I’m looking for guidance how to use PHP and MySQL to manage member access to a site. That is, based on an individual’s membership expiration date to the organization, they would be prevented from accessing the members-only pages. Any help would be greatly appreciated.

Your page will want to do the following:

[list][*]if member is not stored in a session variable

[list][]set a session redirect variable with the current page location
]redirect to a login page[/list]
[*]show the page[/list]

The login page would:

[list][]set a session variable so that other pages can determine that the person is a valid member
]and then return to the redirected page

I make a ACL matrix (With CRUD allow/deny indicators)
and matching position of person with allowed priviledge for that position from database

Thanks very much for responding. I’m afraid I’m very new at this technology and needing a walk-through on the procedure. Any possibility you could point me to an example?

well the best example of acl is this forum itself vbulletin usues it
so does phpbb

and i guess it wont be ideal to refer it to u now,cakephp has very good acl model

and other have look at these

Sorry I was trying to respond to the gentleman from Christchurch. I really can’t understand what you’re saying.

As frank1 said, have a look at this tutorial

People here can tell you how to build it in theory, but as you said you are new to the technology, so why not just use that tutorial to help you.

The tutorial at gives you all of the code to properly setup and manage user and admin permissions. It uses a similar technique as what I described earlier to check if a person has the right permission or not.

For example:

$myACL = new ACL();  
if ($myACL->hasPermission('access_admin') != true)  
    header("location: insufficientPermission.php");  

As they say though, the devil is in the details, but fortunately for you someone else has already worked out the details and provided them for you as a tutorial, so that you end up with a production-ready solution.

Right, I’ll give it a try. Thanks to you all for the great help.