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

class Can_login extends CI_Model
{ 
    function can_admin_login($cid, $password)
    {
       $this->db->where('username',$cid);
       $this->db->where('password',$password);
       $query = $this->db->get('administrator');
       
       //echo "username:".$cid." password:".$password;
       
       if($query->num_rows()>0)
       {
            return true;
       }

       else
       {
           return false;
       }
    }

    function can($cid)
    {
       $this->db->where('cid',$cid);
       $query = $this->db->get('users');
        
       if($query->num_rows()>0)
       {
            return true;
       }

       else
       {
           return false;
       }
    }

    function otp_can($cid,$otp)
    {
       $cid=urldecode($cid);
       $cid=trim($cid);
       $this->db->where('id',$cid);
       $this->db->where('otp',$otp);
       $query = $this->db->get('otp');
        
       if($query->num_rows()>0)
       {
            return true;
       }

       else
       {
           return false;
       }
    }

    function Delete_Otp($cid)
    {
        $cid=urldecode($cid);
        $cid=trim($cid);
        $this -> db -> where('id', $cid);
        $this -> db -> delete('otp');
       // $query=$this->db->query("update user_details SET '$edit_data' where username='$username' ");
    
       if($this->db->affected_rows()>0)
       {     
            return true;
       }
    
       else
       {
           return false;
       }
    }

    

}

?>
