Php 抓取选择的值';ed值编码点火器
我想获得Php 抓取选择的值';ed值编码点火器,php,codeigniter,select,return-value,Php,Codeigniter,Select,Return Value,我想获得secretsalt的值,并在上面列出{{HERE}}的代码中使用它。我该怎么做 $this->db->select('secretsalt,session_id'); $getSaltAndSessionIDFromDb = $this->db->get_where('Client', array('email' =>$ClientEmail)); // generated via registration $result = $getSaltA
secretsalt
的值,并在上面列出{{HERE}}
的代码中使用它。我该怎么做
$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
}
这应该行得通
if($getSaltAndSessionIDFromDb->num_rows() ==1)
$result = $getSaltAndSessionIDFromDb->result_array();
$salt = $result[0]['secretsalt'];
$saltedPasswordToVerify = $ClientPassword.$salt;
然后使用结果
$rs = $this->db->select('secretsalt,session_id')->from('tablename')->get();
$result = $rs->result_object();
如果我理解你的问题,那就行了 但是,这是选择session_id和secretsalt。我只需要ClientPassword.secretsalt怎么做?好的,然后分配$saltFromDb=$result->secretsalt;使用$saltFromDb,但我看不出有什么区别。把它放在get where行下面的正确位置。这就是为什么我加入了最后一行,这样你就可以看到它在哪里了。你能告诉我这是什么样子吗?我很感激。
$saltedPasswordToVerify = $ClientPassword.$result->secretsalt;