![]() |
An Error Was Encountered Unable to load the requested file: home.php - 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: An Error Was Encountered Unable to load the requested file: home.php (/showthread.php?tid=51595) |
An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-10-2012 [eluser]theknight[/eluser] Hi All, For the most part my web app works fine. However sometimes when I log in, I occasionally get the following error: An Error Was Encountered Unable to load the requested file: home.php Why is this happening? Cheers. An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-10-2012 [eluser]theknight[/eluser] Code: function login(){ Here is my controller code. An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-10-2012 [eluser]theknight[/eluser] Just noticed that this happens if a user tries to log in at the same time. Not entirely sure what is going on here. An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-10-2012 [eluser]InsiteFX[/eluser] Try: Code: redirect('/', 'refresh'); An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-10-2012 [eluser]theknight[/eluser] Hi thanks, I think the problem is with this segment of code: Code: $this->data['user']=$this->members->getDetails($this->session->userdata('user')); After the user logs in, it crashes if they try to log in twice with the same browser session. Although I am not exactly sure what the issue is. An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-10-2012 [eluser]InsiteFX[/eluser] See if this will work: Code: redirect(site_url(), 'refresh'); If it is crashing when the user trys to login twice, you should being checking to see if user_id is already logged in. Use CodeIgniters Form_validation class and set the rules on the user name to a callback to see if the user name matches. Check your session user_id and see if it matches your database record before trying to log them in again. Here is where your problem is: Code: if(isset($_POST['username'])){ // logging in An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-11-2012 [eluser]theknight[/eluser] [quote author="InsiteFX" date="1336685049"]See if this will work: Code: redirect(site_url(), 'refresh'); If it is crashing when the user trys to login twice, you should being checking to see if user_id is already logged in. Use CodeIgniters Form_validation class and set the rules on the user name to a callback to see if the user name matches. Check your session user_id and see if it matches your database record before trying to log them in again. [/quote] Hi I am not storing session Ids within the database, rather I am creating them on the fly. As soon as the user logs in first time. Code: Here is where your problem is: Is there anyway thru php I can check if the session has already been created, I uses $_SESSION variable to check but it was empty. Doing this too: echo $this->session->userdata('user'); Cheers. An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-11-2012 [eluser]InsiteFX[/eluser] Show your code were you are setting the users details and session! An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-11-2012 [eluser]theknight[/eluser] Hey man, sure, in function login - before that is just general validation check, to see if the user exists etc etc: Code: $this->session->set_userdata(array('user'=>$res['Id'])); Which corresponds to this segment of code within the controller. Code: // if they are already logged in you do not want to do this! An Error Was Encountered Unable to load the requested file: home.php - El Forum - 05-11-2012 [eluser]theknight[/eluser] Shouldn't it overwrite the session? |