duanbi8529 2012-11-11 23:22
浏览 21
已采纳

抓取SELECT值的Codeigniter值

$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
} 

I want to get the value of secretsalt and use it in the above code where {{HERE}} is listed. How do I do so?

  • 写回答

2条回答 默认 最新

  • dtjzpg5313 2012-11-11 23:35
    关注
    if($getSaltAndSessionIDFromDb->num_rows() ==1)
        $result = $getSaltAndSessionIDFromDb->result_array();
        $salt = $result[0]['secretsalt'];
    $saltedPasswordToVerify = $ClientPassword.$salt;
    

    That should work

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办