0
$this->db->select('secretsalt,session_id'); 
$getSaltAndSessionIDFromDb = $this->db->get_where('Client', array('email' =>$ClientEmail)); // generated via registration
    $result = $getSaltAndSessionIDFromDb->result_array();
    $saltFromDb = $result[0]['secretsalt'];
    $saltedPasswordToVerify = $ClientPassword.$saltFromDb; // combine inputted pass + salt from the db
$isValidUser = $this->db->get_where('Client',array('email'=>$ClientEmail,'pass'=>$saltedPasswordToVerify)); // compare inputted pass + salt vs db entry.


// If [1] row found, login
if($isValidUser->num_rows() == 1 ){
    // set the "Logged in" vars:
    $loggedInValue = 1;
    $this->db->set('loggedIn',$loggedInValue);  // Set valid row loggedIn value = 1.
    // Validate using the below model (loginfunctionmodel) that there is:
        // 1. valid session_id
        // 2. loggedIn=1
    $this->load->model('pages/loginfunctionmodel');
    $this->loginfunctionmodel->check_if_loggedin();
}
else{
    // nothing at the moment
} 

我想在上面列出secretsalt的代码中获取并使用它的值。{{HERE}}我该怎么做?

4

2 回答 2

0
if($getSaltAndSessionIDFromDb->num_rows() ==1)
    $result = $getSaltAndSessionIDFromDb->result_array();
    $salt = $result[0]['secretsalt'];
$saltedPasswordToVerify = $ClientPassword.$salt;

那应该工作

于 2012-11-11T23:35:28.793 回答
0
$rs = $this->db->select('secretsalt,session_id')->from('tablename')->get();
$result = $rs->result_object();

然后使用结果。

$saltedPasswordToVerify = $ClientPassword.$result->secretsalt;

如果我理解了您的问题,那应该可以。

于 2012-11-11T23:39:14.123 回答