Question on auth check with simplelogin - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Question on auth check with simplelogin (/showthread.php?tid=11469) Pages:
1
2
|
Question on auth check with simplelogin - El Forum - 09-10-2008 [eluser]San2k[/eluser] Hi! Didn't find an answer on forums (maybe i looked bad ) I have a problem with checking if user is logged in. So i'am doing this: Code: class MyPROG extends Controller { It checks correctly, but the problem is - that if user is NOT logged, $this->load->view('header'); $this->load->view('login'); - this two view files will be loaded + my Index function will be loaded too. Code: function index() if i put exit; after $this->load->view('login'); in main function - nothing loads at all. My main idea, why i did it that way - is that MyPROG runs before any function in controller(is that right?) - so its the best place to check login. so noone can access any functions bypassing login check. Thanks. Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]San2k[/eluser] No one? Its not so hard question Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]johnwbaxter[/eluser] Instead try: redirect('/controllername/index'); Patience is a virtue Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]San2k[/eluser] where should i put it ? Didnt really understand. Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]johnwbaxter[/eluser] Sorry! Code: class MyPROG extends Controller { Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]johnwbaxter[/eluser] Oh wait, re-reading your post you don't want people to access anything in this controller so you would want to change: Code: redirect(’/myprog/index’); to Code: redirect(’/anothercontroller/index’); Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]San2k[/eluser] Now it's looping all the time )) maybe i wrote my post wrong. I have my login FORM in $this->load->view('header');. So i need to show HEADER. And $this->load->view('login'); The main problem - is that i cant stop executing after i show this two forms. My scripts shows header and login. And then it show index () function too. Its crazy. Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]johnwbaxter[/eluser] It shouldn't loop if you have it set to this redirect(’/anothercontroller/index’); Are you sure you have it redirecting to another controller? Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]San2k[/eluser] Even firefox says. that its looping. Shoing me error message about server loop :\ Question on auth check with simplelogin - El Forum - 09-11-2008 [eluser]johnwbaxter[/eluser] Post your new code for me? |