In one of my CI application there is an user login section. The users are restricted to some pages , ie only members can view that page. So there are two controllers users ( which contain register , login .. ) , admin ( secure pages ) .
My question is if user visit a page on admin then if that user is not logined then have to show login page ( in users controller ) and after successful login it will redirect to the previous page in which user tried to access.
for eg : If user click “myaccount” page then if user is not logined it will redirect to “login” page after successful login will return back in “myaccount” page
Please help
Thanks
in the first create page >>name login.php in the view folder
and write your login page
in the controller you can try this code
and write rhis code in the User_model