Loading...
Make a php driven web site with FrontController approach….
I think FrontController pattern has good solution for this type of problem…
If you follow Front Controller pattern u can easily restrict any pages
from your centralize controller….
for more reading
http://www.phppatterns.com/index.php/article/articleview/81/1/1/
let’s see how Front Controller will work with your user security
public interface PHPFrontController extends BaseController {
// …..
public function isAccessible();
public function getCurrentView();
// …..
}
etc…. you can fun…..
for instance while your index.php is running…
it will cosider:
// Singleton pattern
$frontController=PHPFrontController::newInstance();
// check valid user….
if($frontController->isAccessible()) {
View::generateView(View::HTML, $frontController->getCurrentView());
}
……..
For more details information…
// example implementation of accessible method....
public function isAccessible() {
$state=false;
try {
// you can check through your DAO
if($userDAO->isValideUser(
HttpRequest::getParam(
array(”txtUser”,”txtPassword”))))
$state=true;
}
catch($frameworkException ) {}
return $state;
}
Thank you..







| www.flickr.com |
Leave a reply