开发者

MVC Model, CodeIgniter and auth

开发者 https://www.devze.com 2023-02-06 17:49 出处:网络
i am starting to get the hang on the MVC Model, but I still have some questions. This is one of them I have a website with 6 or 7 main pages. They all share the header view where the logo is, the top

i am starting to get the hang on the MVC Model, but I still have some questions. This is one of them

I have a website with 6 or 7 main pages. They all share the header view where the logo is, the top menu, the search and, most importantly, a login form consisting of a user and a password text fields, and a submit button.

I want the user to be able 开发者_开发问答to login in any page of the site, and return to the page he was if successful.

What is the best way to call the auth controller to login and make sure the user comes back to the same page (call the correct controller)?


Point login form to the script that handles login process. There, you check login/password against your database for example. If login is successful, redirect user to the page he/she came from with this php call header("Location: {$_SERVER['HTTP_REFERER']}");

0

精彩评论

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