control flow in php

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

control flow in php

Postby closed » Tue Jul 26, 2011 3:06 am

hi,

is there any framework out there which allows me to control the control-flow of client-requests. I am searching for something like a middleware: A client request is send to a server, the middleware checks if the request is allowed to do what it wants to do and passes or denies the request.
the user should predefine some conditions. something like it is allowed to redirect or to access file xyz. Based on the request the middleware should check these capabilities and decide whether or not the request is allowed.

thank you
closed
Forum Newbie
 
Posts: 3
Joined: Tue Jul 26, 2011 3:01 am

Re: control flow in php

Postby Benjamin » Tue Jul 26, 2011 3:48 am

You could route all requests through a single file using htaccess. This file could then decide how to route the request.
Image
User avatar
Benjamin
Site Administrator
 
Posts: 6862
Joined: Sun May 19, 2002 10:24 pm

Re: control flow in php

Postby closed » Tue Jul 26, 2011 5:01 am

nope... a htaccess does not implement any logic. you could only add some regular expression to it.

what i need is more specific. the user should be able to tell for every file which actions are allowed or not. so you have to add a middleware (as described above) to solve this issue. with a .htaccess file this won't be possible
closed
Forum Newbie
 
Posts: 3
Joined: Tue Jul 26, 2011 3:01 am

Re: control flow in php

Postby Benjamin » Tue Jul 26, 2011 5:10 am

.htaccess would work fine. The file it routes the requests to would contain the logic.
Image
User avatar
Benjamin
Site Administrator
 
Posts: 6862
Joined: Sun May 19, 2002 10:24 pm

Re: control flow in php

Postby closed » Tue Jul 26, 2011 8:44 am

hmmm... i think its not well understood what i need.

for example: i have a webapp with different modules (m). m1 can redirect to page xyz, m2 can access a file and read it, m3 can print the incomming request in the DOM.
so if a client-request is submitted for m1 by a remote user, the middleware shall analyze this request, check the capabilities (which are predefined) and only allow the processing of this specific request if the request contains some attributes/indicators of a redirection. for this i need to know how the information flow will be in the modules AND i need to control this flow.
same for m2 or m3: if a request is incomming the middleware/framework shall check for the capability and deny or allow the processing.
a simple redirection to a logic file won't help, because i have to implement the logic in every file to be sure not to circumvent the controlflow. eventually i need to add some taints in the request processing process.

if it is still misunderstood, i could try to upload a picture or a flowchart...

thanks for help
closed
Forum Newbie
 
Posts: 3
Joined: Tue Jul 26, 2011 3:01 am

Re: control flow in php

Postby alex.barylski » Fri Jul 29, 2011 2:03 pm

Do what has already been suggested...use .htaccess and index.php to handle the request, dispatching to appropriate controller:action pairs.
alex.barylski
DevNet Evangelist
 
Posts: 6259
Joined: Tue Dec 21, 2004 6:00 pm
Location: Winnipeg

Re: control flow in php

Postby Christopher » Fri Jul 29, 2011 6:13 pm

It sounds like what you are looking for is Access Control. Benjamin is recommending that you implement a Front Controller so that you can centralize the Access Control in one entry point.
(#10850)
User avatar
Christopher
Site Administrator
 
Posts: 12648
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US


Return to PHP - Frameworks

Who is online

Users browsing this forum: 9f6t8l1f3 and 0 guests