How to fix the error validation check account?

103
October 28, 2019, at 10:20 PM

i made the login, the rules if the login true, the login will enter to next form, if another one input true show nottification "username and password not valid, and if all input false back to form login. the error said in form 31 but i think the syntax are correct, what's wrong about the syntax ?

this is codeigniter 3.10 and PHP 7, line 31 in syntax $num_account = count($temp_account);

this is the controller

 public function login()
    {
        $username = $this->input->post('username','true');
        $password = $this->input->post('password','true');
        $temp_account = $this->user_model->check_user_account($username,$password)->row();
        //check account
        $num_account = count($temp_account);
        $this->form_validation->set_rules('username','Username','required');
        $this->form_validation->set_rules('password','Password','required');
        if($this->form_validation->run()==FALSE)
        {
            $this->load->view('account/form_login');
        }
        else {
            if ($num_account > 0) {
                //kalau ada set session
                $array_items = array(
                    'id_user' => $temp_account->id_user,
                    'username' => $temp_account->username,
                    'logged_in' => true
                );
                $this->session->set_userdata($array_items);
                redirect(site_url('account/view_success_page'));
            } else {
                //kalau ga ada diredirect lagi ke halaman login
                $this->session->set_flashdata('notification', 'Peringatan : Username dan Password tidak cocok');
                redirect(site_url('account'));
            }
        }
    }

Message: count(): Parameter must be an array or an object that implements Countable Filename: controllers/account.php Line Number: 31

Method:

function check_user_account($username,$password) { 
    $this->db->select('*'); 
    $this->db->from('user'); 
    $this->db->where('username',$username); 
    $this->db->where('password',$password); 
    return $this->db->get(); 
}
Rent Charter Buses Company
READ ALSO
Symfony Validator - Check password length and content BEFORE hashing

Symfony Validator - Check password length and content BEFORE hashing

I created a password validation, but when I insert a new user, this validation is triggered after encrypting the password

159
Forced browser file cache refresh with javascript

Forced browser file cache refresh with javascript

I have python script in Splunk that generatesdocx report

180
Deny direct access to .php files by users and allow in iframe

Deny direct access to .php files by users and allow in iframe

I want to deny accedss to allphp files in "/xxxxx" directory

166