开发者

Load the view user was at

In my CodeIgniter based website, my sidebar has the login box.

In the login controller, I have the following code:

if ($this->form_validation->run() == FALSE)
        {
            $this-&开发者_C百科gt;load->view('loginfail');
        }           
        else
        {
            $this->load->view('loginsuccess');
        }

Currently, in case of a failed login, it redirects to loginfail view.

What I want to do is send the user back to the view he was at. But since the login box is in a sidebar which is loaded onto every other view, how can I know which view the user was at?


You could try passing it the output of current_url(), which returns the segments of the URI currently viewed; it's a function of the URL helper.

As you suggested, you could place it inside a hidden input field and retrieve the value in the controller/library which handles the authentication.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜