Welcome Guest, Not a member yet? Register   Sign In
codelgniter login check help
#1

[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
#2

[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.
#3

[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
#4

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

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

[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]
#7

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

[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
#9

[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();




Theme © iAndrew 2016 - Forum software by © MyBB