Loading... Cancel

Password protected secure web application with design patterns R

August 22nd, 2005

Probably you want to develop password protected web application using PHP…

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..

Total 3 responses found

Close
  •   nathan clark

    Thu Jan 70 06:33

    i enjoyed reading your stuff. cool site. an investment in knowledge pays the best interest: http://www.quotegallery.com/asp/apcategories.asp?author=BenjaminFranklin , discontent makes rich men poor , think in herds

  • Administrator

    Thu Jan 70 06:33

    Yea backed to my real world...

  •   Arild

    Thu Jan 70 06:33

    the man is blogging again, and smiling, and coding! great. nearly thought we had done something wrong to this bright young talent. so glad to see you in full swing, and also that you are visiting wonderland daily, in office time!

Posted in PHP