开发者

Send POST from php Zend-Framework site

I am currently working on a zend framework site using an ACL.

The ACL works and uses a DB for storing privaliges. What I have done so far is, on in a preDispatch I capture where the user wanted to go to, and if they need to login to get there the page displays the login form. I have also captured if a user has submitted a form and stored the data (location and form data). No problems so far.

The user submits the login form, and I then check if I have a location to send them onto, again no problems here, this works.

However I want to be able to submit the original form data now they are autherised - the only problem is, if I redirect them to the page, the call to:

$this->getRequest()->isPost()

fails as it isn't a post request.

I can forward the user to the page on sucessful login, and in the preDispatch set $_POST to the data originally captured, this works as the original POST s开发者_Python百科till stands, this works but I do not think is the correct way to do this - specially the URL - obviously the page displayed is correct, the form has been submitted correctly, but the URL is of the login process.

Obviously I could change from using $this->getRequest()->isPost() but as there are large amounts which would need changing I was hoping not to have to do this.


The way it's done usually (seen this on many sites), would be to store the form data and requested action in session, then redirect the user to a login page. When login is authorized, you read the session for any pending action, reload the form and populate it with data from session (properly clearing any pending action from session afterwards). The user would just have to click Submit again.

The other way to do this would be to use HttpClient and submit the data as POST with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜