Wednesday, 15 April 2015

php - Error In Login In Codeigniter -


Hi, I am trying to create a code in Codeigniter that returns the following error

  class verification address CI_Controller extended {function __construct () {parent :: __ construct (); $ This- & gt; Load-> Model ('user', '', true); } Function index () {$ this- & gt; Load-> Library ('form_validation'); $ This- & gt; Form_validation- & gt; Set_reales ('username', 'username', 'trim | must | xss_clean'); $ This- & gt; Form_validation- & gt; Set_resales ('password', 'password', 'trim | must | xss_clean | callback_check_database'); If ($ this-> form_validation-> run () == FALSE) {// field validation failed. The user was redirected to the login page- $ this- & gt; Load-> View ('login_view'); } Else {// Go to private sector redirects ('Home', 'Refresh'); }} Function check_database ($ password) {// field validation validate against database executed $ username = $ this- & gt; Input-> Post ('username'); // Query the database $ result = $ this- & gt; User- & gt; Login ($ username, $ password); If ($ result) {$ sess_array = array (); Foreign currency ($ result as $ line) {$ sess_array = array ('id' =>; $ row-> ID, 'username' = & gt; $ row- & gt; username); $ This- & gt; Session-> Set_userdata ('login', $ sess_array); } Return TRUE; } And {$ this- & gt; Form_validation- & gt; Set_message ('check_database', 'invalid user name or password'); return false; }}  

See:

  & lt; Html xmlns = "w3.org/1999/xhtml"> & Lt; Top & gt; & Lt; Title & gt; Admin panel & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;? Php validation_arrow (); ? & Gt; & Lt ;? Php echo form_open ('verification log'); ? & Gt; & Lt; Label = "username" & gt; Username: & lt; / Label & gt; & Lt; Input type = "text" size = "20" id = "user name" name = "username" /> & Lt; Br / & gt; & Lt; Br / & gt; & Lt; Label = "password" & gt; Password: & lt; / Label & gt; & Lt; Input type = "password" size = "20" id = "password" name = "password" /> & Lt; Br / & gt; & Lt; Input type = "submit" value = "login" /> & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;  


No comments:

Post a Comment