Welcome Guest, Not a member yet? Register   Sign In
postgres users authentication
#1

[eluser]XeRGi0[/eluser]
Hello there CI loverss... I have a lil' problem... I'm trying to implement an tiny authentication system, with DBMS users (postgre) instead of tables...

I auto load the database library with a dbms superuser, 'cause i need it to make the validations, to do what i wanted i got to override default database configuration.

The thing is, I made all the validations and stuff... the problem i have is when i'm trying to create a new connection (the new logged user information, such as username and password), it seems that is not creating the connection based on the new configuration i pass throw...

I use a model, a controller and a view...

Model:
Code:
<?php
    Class Auth_model extends Model {
        
        function Auth_model (){
            parent::Model();
            $this->load->database(); // I tried removing database class autoload and calling only this time, but it doesn't work either
        }
        
        function checkUser($str) {
                  //some statements
        }
        
        function checkPass($user, $pass) {
                  //some statements
        }
        
        function login($user, $pass) {
            $this->db->close();
            
            $db['hostname'] = "localhost";
            $db['username'] = $user;
            $db['password'] = $pass;
            $db['database'] = "mydb";
            $db['dbdriver'] = "postgre";
            $db['dbprefix'] = "";
            $db['pconnect'] = TRUE;
            $db['db_debug'] = TRUE;
            $db['cache_on'] = FALSE;
            $db['cachedir'] = "";
            $db['char_set'] = "utf8";
            $db['dbcollat'] = "utf8_general_ci";
            
            $this->load->database($db);
        }
        
    }
?>

Controller:
Code:
<?php
    Class Login extends Controller {
        
        function Login() {
            parent::Controller();
            $this->load->model("auth_model");
        }
        
        function index() {
            $this->load->view('loginForm');
        }
        
        function _checkUser($str) {
                  //some statement
        }
        
        function _checkPass($user, $pass) {
                  //some statements
        }
        
        function do_login() {
            $user = $this->input->post('user', TRUE);
            $pass = $this->input->post('pass', TRUE);
            
                $this->auth_model->login($user, $pass);
                echo $this->db->get_user(); //a function that i added to postgre driver class
            
        }
        
    }
?>

Plz Help! Sad


Messages In This Thread
postgres users authentication - by El Forum - 11-09-2008, 01:22 AM
postgres users authentication - by El Forum - 11-09-2008, 03:06 PM
postgres users authentication - by El Forum - 11-09-2008, 05:27 PM
postgres users authentication - by El Forum - 11-09-2008, 09:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB