CodeIgniter Forums
codelgniter login check help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: codelgniter login check help (/showthread.php?tid=50434)



codelgniter login check help - El Forum - 03-26-2012

[eluser]shivi[/eluser]
hi all i am new and I've been using recently codelgniter framework. so I'm not so expert .
my question is when i create form using helper("form") and after i made function in my home_controller
Code:
public function login(){
        $this->load->library("form_validation");
        $this->form_validation->set_rules("Username","username","required|aplha|xss_clean");
        $this->form_validation->set_rules("Password","password","required|xss_clean");
        
        if($this->form_validation->run() == false){
            $this->load->view("khalsahome_view");
        }else{
            $this->load->view("khalsahome_view");
        }
    }


so i want to know when user put username and password so how i can check inserted username and password is matches with database username and password and redirect user on home page with welcome message

if anybody can help me please thanks


codelgniter login check help - El Forum - 03-26-2012

[eluser]Krzemo[/eluser]
Code:
$this->input->post('username');

If you really want to make your very own login thing - take a look hot it is done in one of the auth libraries for CI.


codelgniter login check help - El Forum - 03-26-2012

[eluser]shivi[/eluser]
hello thanks for answer but where i can find auth library for CI . is there any guide that explane me how i can made my own login sorry for ny stupid question thanks


codelgniter login check help - El Forum - 03-26-2012

[eluser]InsiteFX[/eluser]
Look in the Ignited code topic



codelgniter login check help - El Forum - 03-26-2012

[eluser]cbwd[/eluser]
Is there a reason why you want to DIY and not use something like TankAuth?


codelgniter login check help - El Forum - 03-27-2012

[eluser]shivi[/eluser]
[quote author="shivi" date="1332795408"]hi all i am new and I've been using recently codelgniter framework. so I'm not so expert .
my question is when i create form using helper("form") and after i made function in my home_controller
Code:
public function login(){
        $this->load->library("form_validation");
        $this->form_validation->set_rules("Username","username","required|aplha|xss_clean");
        $this->form_validation->set_rules("Password","password","required|xss_clean");
        
        if($this->form_validation->run() == false){
            $this->load->view("khalsahome_view");
        }else{
            $this->load->view("khalsahome_view");
        }
    }


so i want to know when user put username and password so how i can check inserted username and password is matches with database username and password and redirect user on home page with welcome message

if anybody can help me please thanks[/quote]


codelgniter login check help - El Forum - 03-27-2012

[eluser]Ivar89[/eluser]
Tutorials(also login)


codelgniter login check help - El Forum - 03-27-2012

[eluser]shivi[/eluser]
i made my login model and when i click on login it gives me thius error

my login model code

Code:
<?php
class Login_model extends CI_Model{
    
    public function Login_model(){
        $this->__construct();
    }

    public function __construct(){
        parent::CI_Model();
    }


    public function checklogin($username,$password){
        
        $query = ("SELECT id FROM users_register WHERE username = ? AND password = ?");
        $result = $this->db->query($query,array($username,$password));
        
        if($result->num_rows() == 1){
            return $result->row(0)->id;
        }else{
            return false;
        }
    }
}

Code:
Fatal error: Call to undefined method CI_Model::CI_Model() in /var/www/mvckhalsanet/application/models/login_model.php on line 9



codelgniter login check help - El Forum - 03-27-2012

[eluser]cbwd[/eluser]
You'll find most of your answers in the excellent CI documentation or Google.

The top 3 results from Googling your last error message provided the following:

Code:
parent::__construct();

instead of

Code:
parent::CI_Model();