![]() |
Undefined index: userid & Fatal error: ob_start - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Undefined index: userid & Fatal error: ob_start (/showthread.php?tid=17038) Pages:
1
2
|
Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]langithitam[/eluser] Hy bro, i got this error when i tried to login Quote:A PHP Error was encountered Quote:Fatal error: ob_start() [ref.outcontrol]: Cannot use output buffering in output buffering display handlers in D:\htdocs\shopping\system\libraries\Exceptions.php on line 160 and this is the code Code: function verify(){ Any help will be really appreciated.. ![]() Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]pistolPete[/eluser] You have to check if userid is set before you compare its value: Code: if( isset($_SESSION['userid']) ) Btw: You could also use CI's session class: http://ellislab.com/codeigniter/user-guide/libraries/sessions.html Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]langithitam[/eluser] [quote author="pistolPete" date="1237903941"]You have to check if userid is set before you compare its value: Code: if( isset($_SESSION['userid']) ) Btw: You could also use CI's session class: http://ellislab.com/codeigniter/user-guide/libraries/sessions.html[/quote] i'll try it first.. Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]Stelian Mocanita[/eluser] Code: function verify(){ Also in your MAdmin::verifyUser() where you set the session, your CI rewritten session would be: Code: $userdata['userID'] = $userID; Make sure to have the session class loaded. Should you use PHP's session_autostart you could add Session in autoload(config/autoload.php in the libraries array) or a simple controller call Code: $this->load->library('session'); Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]langithitam[/eluser] @pistolPete, i tried it there is no error. But now, i can't login with ID.. :question: Quote:Sorry, your username or password is incorrect! Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]langithitam[/eluser] @Stelian Mocanita. I tried it, but now i just showing me another error message, Quote:A PHP Error was encountered Quote:A PHP Error was encountered have any clue..? Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]Stelian Mocanita[/eluser] having that the if clauses conditions work left to right you could use them in the same condition like Code: if( isset($_SESSION['userid']) and $_SESSION['userid'] > 0) The code snippet pistolPete wrote is correct, you have a session miss behavior somewhere else. LE: Can you please post the MAdmin::Verify() code here? Undefined index: userid & Fatal error: ob_start - El Forum - 03-24-2009 [eluser]langithitam[/eluser] Yes Stelian, here it is : Code: class MAdmins extends Model{ Undefined index: userid & Fatal error: ob_start - El Forum - 03-25-2009 [eluser]Stelian Mocanita[/eluser] Here is the CI-Session based code: Code: class MAdmins extends Model{ and the other snipper: Code: function verify(){ This should work for you, if not please dump the database results so we can see what happens. Undefined index: userid & Fatal error: ob_start - El Forum - 03-27-2009 [eluser]langithitam[/eluser] Sory, still can't do Stelian. It keep telling me that i got a wrong username or password. Sory stelian i'm newbie, how can i dump the database results? Is it just a common dump using phpmyadmin? thanks. |