Hi I'm back with CodeIgniter Bootstrap Login Tutorial. In this post, we'll see How to Create Login Form in CodeIgniter and Bootstrap Framework along with MySQL Database. Similar to other articles in our codeigniter tutorial series, here too we use twitter bootstrap css to design user interface. Twitter Bootstrap has ready to use HTML Form Components which we use to style our codeigniter login form in seconds.
To create codeigniter login page, I'm going to use MySQL as backend but you can switch over it to any other relational DBMS. Just change over database connection settings in codeigniter config file and you are done!
Creating CodeIgniter Login Form
Before heading to write any code for the login form in codeigniter, we'll fix the MySQL Database we need to use in our example.
Don't Miss: Codeigniter Login, Logout & Sigup System using MySQL & Bootstrap
Create MySQL Database
DB Name: Employee
Table Name: tbl_usrs
CREATE TABLE IF NOT EXISTS `tbl_usrs` ( `id` int(8) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `password` varchar(40) NOT NULL, `email` varchar(60) NOT NULL, `status` varchar(8) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; INSERT INTO `tbl_usrs` (`username`, `password`, `email`, `status`) VALUES ('admin', '21232f297a57a5a743894a0e4a801fc3', 'admin@mydomain.com', 'active');
Run this SQL Command in MySQL Database to create the users table required for the codeIgniter bootstrap login system.
Note: The above sql statement will create the table with a sample user record for testing. The password has been md5 'ed and stored in the db. Use this login credentials for testing purpose, username: admin
password: admin
Here is the Flow for the Login Form in CodeIgniter and Bootstrap we are going to build.
- User enters the username and password.
- Read database & check if an active user record exists with the same username and password.
- If succeeds, redirect user to the Main/Home Page.
- If it fails, show ERROR message.
Also Read: CodeIgniter Database CRUD Operations for Absolute Beginners
The Model
First create the model file for login form in codeigniter with name "login_model.php" in the "application/models" folder.
login_model.php<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class login_model extends CI_Model { function __construct() { // Call the Model constructor parent::__construct(); } //get the username & password from tbl_usrs function get_user($usr, $pwd) { $sql = "select * from tbl_usrs where username = '" . $usr . "' and password = '" . md5($pwd) . "' and status = 'active'"; $query = $this->db->query($sql); return $query->num_rows(); } }?>
The Controller
Next create the controller for our codeigniter login form with the name "login.php" in the "application/controllers" folder.
login.php<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class login extends CI_Controller { public function __construct() { parent::__construct(); $this->load->library('session'); $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('html'); $this->load->database(); $this->load->library('form_validation'); //load the login model $this->load->model('login_model'); } public function index() { //get the posted values $username = $this->input->post("txt_username"); $password = $this->input->post("txt_password"); //set validations $this->form_validation->set_rules("txt_username", "Username", "trim|required"); $this->form_validation->set_rules("txt_password", "Password", "trim|required"); if ($this->form_validation->run() == FALSE) { //validation fails $this->load->view('login_view'); } else { //validation succeeds if ($this->input->post('btn_login') == "Login") { //check if username and password is correct $usr_result = $this->login_model->get_user($username, $password); if ($usr_result > 0) //active user record is present { //set the session variables $sessiondata = array( 'username' => $username, 'loginuser' => TRUE ); $this->session->set_userdata($sessiondata); redirect("index"); } else { $this->session->set_flashdata('msg', '<div class="alert alert-danger text-center">Invalid username and password!</div>'); redirect('login/index'); } } else { redirect('login/index'); } } } }?>
The View
Finally create the view file with name "login_view.php" in the folder "application/views". Here is where we integrate bootstrap with codeigniter php framework and add HTML tags to create the actual login form in the codeigniter view.
login_view.php<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Login Form</title> <!--link the bootstrap css file--> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> <style type="text/css"> .colbox { margin-left: 0px; margin-right: 0px; } </style> </head> <body> <div class="container"> <div class="row"> <div class="col-lg-6 col-sm-6"> <h1>LIVEDOTCOM</h1> </div> <div class="col-lg-6 col-sm-6"> <ul class="nav nav-pills pull-right" style="margin-top:20px"> <li class="active"><a href="#">Login</a></li> <li><a href="#">Signup</a></li> </ul> </div> </div> </div> <hr/> <div class="container"> <div class="row"> <div class="col-lg-4 col-sm-4 well"> <?php $attributes = array("class" => "form-horizontal", "id" => "loginform", "name" => "loginform"); echo form_open("login/index", $attributes);?> <fieldset> <legend>Login</legend> <div class="form-group"> <div class="row colbox"> <div class="col-lg-4 col-sm-4"> <label for="txt_username" class="control-label">Username</label> </div> <div class="col-lg-8 col-sm-8"> <input class="form-control" id="txt_username" name="txt_username" placeholder="Username" type="text" value="<?php echo set_value('txt_username'); ?>" /> <span class="text-danger"><?php echo form_error('txt_username'); ?></span> </div> </div> </div> <div class="form-group"> <div class="row colbox"> <div class="col-lg-4 col-sm-4"> <label for="txt_password" class="control-label">Password</label> </div> <div class="col-lg-8 col-sm-8"> <input class="form-control" id="txt_password" name="txt_password" placeholder="Password" type="password" value="<?php echo set_value('txt_password'); ?>" /> <span class="text-danger"><?php echo form_error('txt_password'); ?></span> </div> </div> </div> <div class="form-group"> <div class="col-lg-12 col-sm-12 text-center"> <input id="btn_login" name="btn_login" type="submit" class="btn btn-default" value="Login" /> <input id="btn_cancel" name="btn_cancel" type="reset" class="btn btn-default" value="Cancel" /> </div> </div> </fieldset> <?php echo form_close(); ?> <?php echo $this->session->flashdata('msg'); ?> </div> </div> </div> <!--load jQuery library--> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!--load bootstrap.js--> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </body> </html>
Note: You can load Bootstrap files from CDN to load faster. Include jQurey.js prior to bootstrap.js files as they depend on jQuery library.
Must Read: CodeIgniter User Registration Page with Email Confirmation
Have any problem in implementing this login form in codeigniter, bootstrap and mysql? Got some suggestion for improvement? Let me know through your comments.
Look into our CodeIgniter Tutorials Section for more advanced articles.
Last-Modified: Dec-24-2016
Hi there,
ReplyDeleteI'm new in codeigniter & bootstrap, but after installation of these tutorial pages, I've this error:
Fatal error: Call to undefined function form_open() in C:\inetpub\wwwroot\newportal\application\views\login_view.php on line 40
Please help me!!
Thanks in advance.
Antonio
Hi, it seems like codeigniter's form helper is not loaded properly. Please make sure you have included it inside the controller's constructor function like this.
Deleteclass login extends CI_Controller
{
public function __construct()
{
parent::__construct();
...
$this->load->helper('form');
...
}
}
Hope this helps :)
Hi, unfortunatly this code is just into the controller, so the error persist.
DeleteHave you any others ideas?
Thanks,
Antonio
Hi, you can try auto loading the helpers and libraries in the 'application\config\autoload.php' file like this,
Delete$autoload['helper'] = array('form', 'url', 'html');
$autoload['libraries'] = array('database', 'session', 'form_validation');
autoload worked thanks a lot
Deletei'm follow this steps but not solve my error...Help Me plz..!!
DeleteI'm Follow this steps but not solve my error..Please Help Me...!!
Deletewhy i got error from this code after follow all of ur instructions
ReplyDelete" "form-horizontal", "id" => "loginform", "name" => "loginform");
echo form_open("login_c/index", $attributes);
?>"
The error appear like this "The requested URL /.../login_c/index was not found on this server."
can you please help me.
Hi! Using wrong path to run a controller will throw such error. Try to run the file like this,
Deletehttp://localhost/codeigniter_demo/index.php/login
(assuming you run this in localhost)
where 'codeigniter_demo' is the codeigniter app (folder) name,
'login' is the name of the controller class (ie., which you have used in this code => class login extends CI_Controller)
Note: If you have your app folder in different location, then use the exact location to run the file. As a rule of thumb the path should be like this,
http://localhost/path/to/codeigniter_app/index.php/controller_class_name
Cheers.
Error Number: 1054
ReplyDeleteUnknown column 'var_username' in 'where clause'
select * from tbl_usrs where var_username = test and var_password = 098f6bcd4621d373cade4e832627b4f6 and var_status = 'active'
Filename: models/Login_model.php
Line Number: 15
what is wrong ?
Hi, there was some db table column name mismatch error in the model query. Thanks for bringing out... I have corrected it. It should work now :)
ReplyDeleteCheers!!
Thanks for the collaboration Valli. There some details that needs to be fixed in the example in order to work:
ReplyDelete1. Rename: login_model.php to Login_model.php (caps)
2. Rename: login.php to Login.php (caps)
3. Is better to let the framework to handle the query. Change the 3 lines of the query in Login_model.php for the following:
$this->db->where('username', $usr);
$this->db->where('password', md5($pwd));
$query = $this->db->get('users');
return $query->num_rows();
Hope this helps.
Hi, thanks for your input. Yep! It's a good practice to stick on to the frameworks db handling features. But it's not necessary for the file names to start with caps although ci suggests naming the controller class names starting with caps. CI itself is somewhat inconsistent with naming convention rules and there aren't much. Irrespective of using upper or lower case namings, the above code works if you access the controller with the proper url.
DeleteHope that helps :-)
It worked, and no errors but where do I have to put the "status=' ' " part in the scripts above?
DeleteAnd also I can't login, always result invalid login name and password.
Hi, 'status' is a column name present in the db table and it should be set as active to allow the particular user to login to the site (useful for membership websites).
DeleteAnd the answer for the second question is you should create a valid db table with field values and then use those login credentials with the script. Then it will work.
Cheers.
A Database Error Occurred
DeleteError Number: 1146
Table 'mathevent.tbl_usrs' doesn't exist
select * from tbl_usrs where username = 'supriamir' and password = '65a4e5c03f7ce2a21538ceafa46b8c6a' and status = 'active'
Filename: models/Login_model.php
Line Number: 16
Hi there, I get this error. I do i fix this. Before I already had mathevent database.
Thanks
Supri
An Error Was Encountered
ReplyDeleteUnable to load the requested file: Login_view.php
What's wrong? Please help!
An Error Was Encountered
ReplyDeleteUnable to load the requested file: Login_view.php
What's wrong? Please help!
An Error Was Encountered
ReplyDeleteUnable to load the requested file: Login_view.php
What's wrong? Please help!
Hi !! File names are case sensitive. Please check you use the same case as in view folder.
Deleteif you have the file as Login_view.php then load the view in controller as,
$this->load->view('Login_view');
Hope this helps :)
The requested URL /newpro/login/index was not found on this server.
ReplyDeletewhat is error..
Hi! CI follows a url structure like below unless you specifically rewrite the urls with htacess file.
Delete[base_url] / index.php / [controller_name] / [controller_function_name]
So say if I have an app folder with name 'cidemo' and I want to access a controller with file name 'login.php' and class name of 'login', then I access it in localhost like,
http://localhost/cidemo/index.php/login
The default function called in controller is index(), so you need not specify it in the url.
I hope this helps :)
Im getting this error pls help me....
ReplyDeleteA Database Error Occurred
Error Number: 1054
Unknown column 'eranda' in 'where clause'
select * from tbl_usrs where username = eranda and password = 202cb962ac59075b964b07152d234b70 and status = 'active'
Filename: /var/www/CI/models/login_model.php
Line Number: 15
Hi! Since the username and password fields are both strings use quotes in the sql query like this,
Delete$sql = "select * from tbl_usrs where username = '" . $usr . "' and password = '" . md5($pwd) . "' and status = 'active'";
This should work :)
Hi,
ReplyDeleteI can`t login. Invalid username and password!
How can I add user to database ? Password field in database must be md5 sum or plain text?
Hi! A valid user record should be present in the db for the login script to work. Usually for membership sites, the user records will be inserted with the sign up (registration) form. And yes the password should be md5 encrypted and stored in the db.
ReplyDeleteNote: For testing this script you can just insert some user data to the db using mysql gui like phpmyadmin.
Cheers.
hey why don't you provide demo of the example ..!
ReplyDeletealso you can provide code in zip format...!
that make everyone life easy... :)
hope this help everyone...!
Unable to locate the specified class: Session.php
ReplyDeleteThis problem occurs when you try to call session library without loading it.
DeleteYou should either load the session library inside the controller's constructor like this,
$this->load->library('session');
or you should auto load it inside the file, application >> config >> autoload.php like this,
$autoload['libraries'] = array('session', 'database', 'form_validation');
Either way it works :)
its not connecting to the database?
ReplyDeletePlease check this tutorial to properly configure and set up database connection in codeigniter.
Deletehttp://www.kodingmadesimple.com/2015/05/install-setup-php-codeigniter-framework-xampp-localhost.html
Hope this helps :-)
Error Number: 1064
ReplyDeleteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''aa47f8215c6f30a0dcdb2a36a9f4168e' at line 1
select * from admin where username='daniel' and password='aa47f8215c6f30a0dcdb2a36a9f4168e
Filename: C:\AppServ\www\TA\system\database\DB_driver.php
Line Number: 330
my sintax : $sql = "select * from admin where username='".$username."' and password='".md5($pass);
any wrong with my syntax? tq before :)
Hi! Change the sql statement like this,
Delete$sql = "select * from admin where username='".$username."' and password='".md5($pass)."'";
You have missed out the closing quotes.
Cheers.
DeleteJust delete md5 from code, i did it and it worked...
Can i ask how does one check on a page if your loged in or not ie to create a logout link
ReplyDeleteHi, during login process you have to save the user details & logged in status within session like this,
Delete$data = array(
'user_id' => $id,
'user_name' => $name,
'is_logged_in' => TRUE
);
$this->session->set_userdata($data);
Then you can check out if the user is logged in or not like this,
if ($this->session->userdata('is_logged_in') == TRUE)
{
// logged in
}
else
{
// not logged in
}
Also make sure to load the session library for this to work.
Hope this helps :)
Cheers.
hey, how do you echo out the username when your logged in? sorry... i'm new to this
DeleteDuring login process we store the 'username' in session variable. So you can use echo $this->session->userdata('username'); anywhere you want to display the logged-in username. The session data will be maintained until the user logs out.
DeleteCheers.
Hi, Excellent article.
ReplyDeleteI am a noob and would like to know how do we integrate this user table into the db - do we add it to whatever app we have as a separate stand-alone table?
Hi! This example uses MySQL DB. You have to create a database with name 'employee' and run the sql command given in the tutorial in MySQL. It'll automatically creates the required table structure.
DeleteCheers.
Valli.
I like your site....
ReplyDelete
DeleteI'm glad you liked it! Thanks for your support.
Cheers
Valli.
Hi, i've followed this tutorial and the previous one to remove the 'index.php' from the URL. The problem is, when i tried to run the login page with http://localhost/ci_demo/login as the address, it redirects to XAMPP home page instead. I've also tried with http://localhost/ci_demo/index.php/login but it showed me the 404 message. Am i missing something here? :(
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello
ReplyDeleteThank you a lot for your article, it really helped me a lot.
I have a strange problem here. When I load the page, it loads only till <php, and then - nothing.
The only difference from your files is that I have header in separate file, so I'm including it with php also. And it works, so php itself is running.
But even if I copy your code, the result is the same - these php functions are just not running. Do you have an idea what the reason may be? Thanks
Hi! It's difficult to fix the problem without seeing your code. Any how I commonly see some people using opening & closing html tags on both views if they split up the header in a separate file.
DeleteMake sure your header contains up to closing head tag and the body element & closing html tags are present in the other view file.
I hope this makes sense.
Cheers.
Hi, I've followed all your instructions but whenever I log in it always tells me that I have an invalid username and password
ReplyDeleteHi, I've followed all your instructions but whenever I log in it always tells me that I have an invalid username and password
ReplyDeleteHi! You must have at least one user record in the database for the login process to work. Inserting some data and try out. Please note the password field is md5 and stored in database.
DeleteCheck out this user registration tutorial first to know more,
http://www.kodingmadesimple.com/2015/08/create-simple-registration-form-codeigniter-email-verification.html
Hope this helps!
Cheers.
i have the same problem... i have set up my database and table with md5 and still doesn't work.. plzzzzz help!!!
DeleteHi! I have updated the tutorial with user records for testing purpose. Please check it out.
DeleteHi! After im trying to login and failed. something wrong. You need to edit column password . Chage varchar(30) to varchar(35).
DeleteIncreasing the password column length in database will fix the issue. I have updated the post. Please check it out.
DeleteCheers.
guys add this in the controller contructor
ReplyDelete$this->load->library('form_validation');
if not working!
Hi, great article,
ReplyDeletei found one error in db structure.
The password field of database [`password` varchar(30)] should be longer. In fact when i try to insert the MD5 value it's truncated. the field should be 32 char long at least.
cheers
Thanks for your input. The password length has been gn wrong somehow. I'll fix it.
Deletei couldnot login. Always shows invalid username and password/
ReplyDeleteSorry! Just increase the password field length to 40 chars or more in database. That will fix the issue.
DeleteCheers.
When i click in login, the page redirect me to a blank page !
ReplyDeleteHow can i fix it ?
The scope of this tutorial is to show how to implement login page alone in a site. But in real world application, after successful login, the user should be redirected to some other pages like home or myaccount page. For that you have to build another controller for home page and redirect to it like this.
Deleteredirect('home/index');
Hope you get it right. Cheers.
hi, can you share some details, how to build another controller for home page?
DeleteI am new, after username and password, see the following error:
404 Page Not Found
The page you requested was not found.
I think its successfully logged in, but unable to find the next page.
Like I mentioned above, once your login is successful you can redirect user to home page. To create home page you atleast need a controller and a view. Look in our ci tutorials section to know about creating controllers. The process has been referred several times.
DeleteHope this helps.
Hey, thank you for the tutorial, but I cannot make it work. It just show me the LIVEDOTCOM title, the Login and Signup buttons and a disabled textbox. What am I doing wrong? I'v doubled check all the code to follow you tutorial even the comments...
ReplyDeleteHelp me, please!
Thank you
Can you copy paste your code in pastebin and provide me the link? I can check it out for you.
DeleteCheers.
In order to run your code in CI 3, we need to be change some things:
ReplyDelete1. create table ci_session
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
PRIMARY KEY (id),
KEY `ci_sessions_timestamp` (`timestamp`)
);
2. Modify config.php
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_session'; // table name ci_session
I get this error: In order to use the Session class you are required to set an encryption key in your config file.
ReplyDeletewhat should I do ?
Codeigniter needs you to set encryption key if you use session library. By default it will be set to null string in config.php file. Just add some encryption key in the config file.
Delete$config['encryption_key'] = 'your encryption key here';
This will fix the issue.
Cheers.
Error Number: 1064
ReplyDeleteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id` = '716995328b10b62fbec86969070e8f739dd4fadd'' at line 2
SELECT `data` WHERE `id` = '716995328b10b62fbec86969070e8f739dd4fadd'
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 166
what about this? im using CI3
It seems like ci tries to store session details in the db. If you are using CI3 and chose session driver as database, then make sure you have the following settings in the config.php file.
Delete$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';
Also check you have this mysql database table for storing session data.
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);
Here is the official documentation link for the setup.
http://www.codeigniter.com/userguide3/libraries/sessions.html#database-driver
Hope this helps!
Cheers.
during redirect, baseurl is also taken. so redirect is not working.
ReplyDeletewhat can i do for that?
This code is not working
ReplyDeleteWhat's the issue you face?
DeleteA Database Error Occurred
ReplyDeleteUnable to select the specified database: employee
Filename: C:\wamp\www\Ci_login_bootstrap\system\database\DB_driver.php
Line Number: 141
i had select the proper database.
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'employee';
please give me solution for this
A Database Error Occurred
ReplyDeleteUnable to select the specified database: employee
Filename: C:\wamp\www\Ci_login_bootstrap\system\database\DB_driver.php
Line Number: 141
i am done with all config of database still it is showing this error
help me out from this
Hello Valli. I refer to your past tutorial 2 Step Registration with Email Verification http://www.kodingmadesimple.com/2015/08/create-simple-registration-form-codeigniter-email-verification.html The QUESTION is How can i check if my Account is activated? Example I login but my account is not Activated how can i check that???
ReplyDeleteplease give video
ReplyDeleteI'm considering... maybe in the near future:)
DeleteHi ,I am getting this kind of error !
ReplyDeleteObject not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
Object not found!
ReplyDeleteThe requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
when I press the url change to http://localhost/Codeigniter/login_view.php/login/index why? :(
ReplyDeletewhen i click Login button entering 'admin' as username and password this error comes:
ReplyDeleteCall to a member function get_user() on null
please help :/
when i enter 'admin' as usernam and password this error is encounterd
ReplyDeleteCall to a member function get_user() on null
please help :/
Hi. I like your site it really useful to me as a beginners , anyway I'm so stock here when I login the username and password is going to login_form even though the username and password is not on databse w/c means is not matching ..
ReplyDeletehttp://localhost/test/index.php/login/index
and when I login and login , the username and password is not validate . I mean NO Validation_errors(); says.
thank you.
Hi. I like your site it really useful to me as a beginners , anyway I'm so stock here when I login the username and password is going to login_form even though the username and password is not on databse w/c means is not matching ..
ReplyDeletehttp://localhost/test/index.php/login/index
and when I login and login , the username and password is not validate . I mean NO Validation_errors(); says.
thank you.
Hi, I have a controller i need to protect it so that only logged users can view it
ReplyDeletehow to achieve that i m new in codeigniter :)
You can save user logged in status in session and check it to restrict access to any page like this,
Deleteif ($this->session->userdata('is_logged_in') != TRUE)
{
// redirect user to home or whereever you want
}
Hope this helps! Cheers!!!
?
ReplyDeleteHow can we ensure that the restricted pages are accessed directly? What code will go in header in such case?
ReplyDeleteHow can we ensure that the restricted pages are accessed directly? What code will go in header in such case?
ReplyDeletehi
ReplyDeletei am getting following error
An uncaught Exception was encountered
Type: RuntimeException
Message: Unable to locate the model you have specified: Login_model
Filename: /var/www/codeigniter/system/core/Loader.php
Line Number: 314
Backtrace:
File: /var/www/codeigniter/application/controllers/Login.php
Line: 8
Function: __construct
File: /var/www/codeigniter/index.php
Line: 292
Function: require_once
please help
hi
ReplyDeletei am getting following error
An uncaught Exception was encountered
Type: RuntimeException
Message: Unable to locate the model you have specified: Login_model
Filename: /var/www/codeigniter/system/core/Loader.php
Line Number: 314
Backtrace:
File: /var/www/codeigniter/application/controllers/Login.php
Line: 8
Function: __construct
File: /var/www/codeigniter/index.php
Line: 292
Function: require_once
as I make a validation for multi users
ReplyDeleteas I make a validation for multi users
ReplyDeleteI can not log in although i create a db named 'ict_aissignment' which has admin user that has "admin" password. It still shows "invalid user".
ReplyDeleteError Number: 1046
ReplyDeleteNo database selected
select * from tbl_usrs where username = 'twinkal' and password = '48d7f9ee3d6c99ff1ab8542cc4359d12' and status = 'active'
Filename: D:/xampp/htdocs/CI/form/system/database/DB_driver.php
Line Number: 691
please give the solution at twinkalkushwaha@gmail.com
After input username and password then click "Login" or press Enter, it redirect to localhost/xampp. Whats wrong with my code?
ReplyDeleteHello. I used this code in my editor and this piece of code: "form-horizontal", "id" => "loginform", "name" => "loginform"); echo form_open("login/index", $attributes);?> is displaying in my login form page in browser. I read the comments above and i noticed that someone else had the same problem. I followed ur suggestions but nothing happened. Please help me!
ReplyDeleteObject not found!
ReplyDeleteThe requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28
Object not found!
ReplyDeleteThe requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28
display invalid username and password plz help me how to short this error in login page
ReplyDeletein login_view.php when we enter username and password there is error invaild username and password plz help
ReplyDeletehow to fetch login user all data from database
ReplyDeletehow to fetch login user all data from database
ReplyDeleteFatal error: Call to undefined function form_open() in E:\php\xampp\htdocs\ey_code\CodeIgniter\application\views\login_view.php on line 40
ReplyDeletealso set helper properly
Hi, seems like form helper error. Try autoloading the helpers and libraries in the 'application\config\autoload.php' file like this,
Delete$autoload['helper'] = array('form', 'url', 'html');
$autoload['libraries'] = array('database', 'session', 'form_validation');
Cheers.
Object not found!
ReplyDeleteThe requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1