Respond to the Programming Problem

timer Asked: Mar 11th, 2014

Question description

I am using code igniter and I got a project from my friend to make the login system. 

I made the dB and the username and password are in the database. I put the exact credentials but when I log in it just refreshes.

I don't know what all code you require, just comment below and I'll reply back.

The user.php code:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Users extends CI_Controller {

function __construct() {



public function index() {

$data['sign_in'] = array();

echo $this->load->view('includes/header', (isset($data['header']) ? $data['header'] : ''), true);

echo $this->load->view('includes/main_menubar', (isset($data['main_menubar']) ? $data['main_menubar'] : ''), true);

echo $this->load->view('sign_in', (isset($data['sign_in']) ? $data['sign_in'] : ''), true);

echo $this->load->view('includes/footer', (isset($data['footer']) ? $data['footer'] : ''), true);


public function sign_in() {

if($_POST) {

$this->form_validation->set_rules('username', 'Username', 'required');

$this->form_validation->set_rules('password', 'Password', 'required|password');

if($this->form_validation->run() != FALSE) {


$username = $this->input->post('username');

$password = $this->input->post('password');

$this->users_model->sign_in($username, $password);



} else {




public function sign_out() {






Here is the admin area sign in php code:

<div class="content_segment recentMovies clearfix">

    <div class="segment_title clearfix">

        Sign in

    </div> <!-- segment_title -->

    <div class="inner_padding list clearfix">

    <?php echo form_open_multipart('users/sign_in'); ?>


        <p><label>Username:</label> <?php echo form_input(array('name' => 'username', 'id' => 'i_username', 'value' => set_value('username'))); ?></p>

        <p><label>Password:</label> <?php echo form_password(array('name' => 'password', 'id' => 'i_password', 'value' => set_value('password'))); ?></p>

        <p><label>&nbsp;</label> <input type="submit" name="submit_sign_in" value="Log me in!" /></p>


        <?php echo form_close(); ?>

    </div> <!-- list -->

</div> <!-- content_segment -->

Tutor Answer

(Top Tutor) Studypool Tutor
School: Boston College
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors