PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Dec 20, 2014 4:41 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: control flow in php
PostPosted: Tue Jul 26, 2011 3:06 am 
Offline
Forum Newbie

Joined: Tue Jul 26, 2011 3:01 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: control flow in php
PostPosted: Tue Jul 26, 2011 3:48 am 
Offline
Site Administrator
User avatar

Joined: Sun May 19, 2002 10:24 pm
Posts: 6875
You could route all requests through a single file using htaccess. This file could then decide how to route the request.

_________________
Image


Top
 Profile  
 
 Post subject: Re: control flow in php
PostPosted: Tue Jul 26, 2011 5:01 am 
Offline
Forum Newbie

Joined: Tue Jul 26, 2011 3:01 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: control flow in php
PostPosted: Tue Jul 26, 2011 5:10 am 
Offline
Site Administrator
User avatar

Joined: Sun May 19, 2002 10:24 pm
Posts: 6875
.htaccess would work fine. The file it routes the requests to would contain the logic.

_________________
Image


Top
 Profile  
 
 Post subject: Re: control flow in php
PostPosted: Tue Jul 26, 2011 8:44 am 
Offline
Forum Newbie

Joined: Tue Jul 26, 2011 3:01 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: control flow in php
PostPosted: Fri Jul 29, 2011 2:03 pm 
Offline
DevNet Evangelist

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


Top
 Profile  
 
 Post subject: Re: control flow in php
PostPosted: Fri Jul 29, 2011 6:13 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 12722
Location: New York, NY, US
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)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group