Codeigniter登录(会话)问题

时间:2019-11-18 11:14:05

标签: php authentication session codeigniter-3 vps

我的网站托管在具有PHP版本(5.6)的VPS服务器上。 我遇到登录问题。如果清除浏览器缓存,则可以登录。 问题在于会话由于会话值为空而将我重定向回登录页面。 我的会话值存储在数据库中。 我的登录控制器代码如下。

if ($this->input->post()) {
    // echo '<br>hiii';
    $username = trim($this->input->post('user_id'));
    $password = trim($this->input->post('password'));
    $where = "(mobile_number = '".$username."' OR email = '".$username."') AND password = '".$password."' AND deactive='0'";
    $where = "(mobile_number = '".$username."' OR email = '".$username."' AND deactive='0')";
    $where_or = array('password' => $password);
    $result = $this->mdgeneraldml->select('*', 'tbl_user', $where, '', '', '', '', '', '', '', '', '', '', $where_or);
    if (count($result) > 0) {
        if ($result[0]['profile_pic'] != '') {
            $profile_img = base_url() . 'img/users/' . $result[0]['profile_pic'];
        } else {
            $profile_img = base_url() . 'img/default_user.png';
        }
    }
}

会话库已加载到config / autoload.php

$autoload['libraries'] = array('database','session', 'email');

1 个答案:

答案 0 :(得分:0)

请检查您的codeigniter版本,如果它是最旧的版本,请尝试用您的项目系统目录替换系统目录,这将解决问题