Welcome Guest, Not a member yet? Register   Sign In
Confusing Session Class change
#8

(12-31-2015, 10:29 AM)natefrogg028 Wrote: Mike,
Haven't had time to look into your problem but off the top of my head, are you trying to use the database driver? And if so, have you correctly set the table name (and created it for that matter?)

Nate Yes I am using the database driver, here is the config for it.

Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 3600;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

And I used the standard DB table
Code:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
       `id` varchar(40) NOT NULL,
       `ip_address` varchar(45) NOT NULL,
       `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
       `data` blob NOT NULL,
       KEY `ci_sessions_timestamp` (`timestamp`)
);

What I am looking at now is if there is something in the php.ini that I should be looking for under sessions?

This is the code i am working with. I can check session state and is keeping it right up until I do the redirect to the page that they logged in from. When I check session state at the beginning of the return page, the only variable showing is the session id, and it is the same session id from the last check state before the redirect?

PHP Code:
function authenticate($username$password$page) {
        
// $this->load->model ( 'Db_model' );
        
        // query the db and send back result
        
$authenticate $this->authenticate_user $username$password );
        
// print_r($authenticate);
        
if (is_array $authenticate )) {
            
// echo 'returned from authenticating';
            // set session values
            
$this->set_session_values $authenticate );
             
var_dump($this->session->all_userdata());
            
// session_commit();
            
if (isset ( $_SESSION ['user_id'] )) {
                
// $msg = "Sessions were set correctly";
                // $this->do_alert($msg);
                
redirect base_url $page ), 'location'301 );
            } else {
                
$msg "Error: Sessions were not set correctly.";
                
$this->do_alert $msg );
            }
        } elseif (
preg_match '/\bError\b/i'$authenticate )) {
            
$this->do_alert $authenticate );
            ;
        }
    }
    function 
authenticate_user($username$password) {
        
// echo 'inside of authenticate_user';
        // CALL `mike7418_greyhorse`.`sp_authenticate`(<{in_username VARCHAR(16)}>, <{in_password VARCHAR(255)}>);
        
$auth $this->db->query "CALL sp_authenticate('{$username}')" );
        
$crypt $this->config->item 'encryption_key' );
        if (
$auth->num_rows () > 0) {
            
// foreach ( $auth->result () as $key ) {
            // $pwd = $this->encrypt->decode ( $key->password, $crypt );
            // print $pwd;
            // $pattern = '/\b' . $password . '\b/i';
            
$key $auth->row ();
            if (
password_verify $password$key->password )) {
                 echo 
"Password matched";
                if (
$key->active == 0) {
                    return 
'Error: Member account is not currently active.';
                } elseif (
$key->blocked == 1) {
                    return 
'Error: Member account has been blocked. Please contact customer service for further information';
                }
                
$session = array (
                        
'user_id' => $key->user_id,
                        
'firstname' => $key->firstname,
                        
'state' => $key->state,
                        
'zipcode' => $key->zipcode,
                        
'active' => $key->active,
                        
'user_role' => $key->user_role,
                        
'sess_expiration' => 3600 
                
);
                
$auth->free_result ();
                return 
$session;
            } else {
                return 
"Error: Password entered does not match";
            }
            
// }
        
} else {
            return 
'Error: Authentication failed, please try again';
        }
    } 
Reply


Messages In This Thread
Confusing Session Class change - by natefrogg028 - 12-30-2015, 05:06 PM
RE: Confusing Session Class change - by skunkbad - 12-30-2015, 05:51 PM
RE: Confusing Session Class change - by kilishan - 12-30-2015, 09:33 PM
RE: Confusing Session Class change - by mike7418 - 12-31-2015, 05:06 AM
RE: Confusing Session Class change - by mike7418 - 12-31-2015, 04:06 PM
RE: Confusing Session Class change - by mwhitney - 12-31-2015, 11:37 AM
RE: Confusing Session Class change - by Narf - 12-31-2015, 08:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB