登录使用错误的用户名和密码访问该帐户

用户名

在下面的代码中,我放置了控制器和模块。当用户处于非活动状态时,他应该无法访问该帐户,只有创建的帐户用户才能访问该帐户。纠正问题。控制器:

function validate_credentials()
        {   $this->load->helper('url');

            $this->load->model('membership_model');
            $query = $this->membership_model->validate();

            if($query) // if the user's credentials validated...
            {
                $data = array(
                    'username' => $this->input->post('username'),
                    'is_logged_in' => true
                );
                 $data1 = array(
                    'college_name' => $this->input->post('college_name'),
                    'is_logged_in' => true
                );
                 $this->session->set_userdata($data1);
                 redirect('site1/members_area');
                if($query->num_rows()>0){
                 $status = $query->row()->account_status;}
                else {
                 $status = ''; }
                 //Account active
                if($status == 'active')
                {
                   $this->session->set_userdata($data);
                   redirect('site1/members_area');
                }
                else  if ($status == 'inactive')//Account In active
                {  $this->inactive();
                  }
                  else // incorrect username or password
            {
                $this->invalid();
            }
            }

        }   

    function inactive()
        {
        echo"<script>alert('In active user Please contact the administrator');</script>";
        $this->load->view('login_form'); 
        }
        function invalid()
        {
        echo"<script>alert('Invalid username or password');</script>";
        $this->load->view('login_form'); 
        }

site1

function members_area()
    {
        $this->load->view('index');


    }

模型:

function validate()
    {
        $this->db->where('username', $this->input->post('username'));
        $this->db->where('password', md5($this->input->post('password')));
            $this->db->where('college_name', $this->input->post('college_name'));
        $query = $this->db->get('membership');

        return $query;

    }
用户名
function validate_credentials()
    {   $this->load->helper('url');

        $this->load->model('membership_model');
        $query = $this->membership_model->validate();

        if($query) // if the user's credentials validated...
        {
            $data = array(
                'username' => $this->input->post('username'),
                'is_logged_in' => true
            );
             $data1 = array(
                'college_name' => $this->input->post('college_name'),
                'is_logged_in' => true
            );
             $this->session->set_userdata($data1);

            if($query->num_rows()>0){
             $status = $query->row()->account_status;}
            else {
             $status = ''; }
             //Account active
            if($status == 'active')
            {
               $this->session->set_userdata($data);
               redirect('site1/members_area');
            }
            else  if ($status == 'inactive')//Account In active
            {  $this->inactive();
              }
              else // incorrect username or password
        {
            $this->invalid();
        }
        }

    }   

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

当使用正确的帐户和密码进行“ npm login”登录时,为什么仍然获得“用户名或密码错误”?

使用帐户,用户名,密码登录到AWS Console

php mysql会话使用错误的用户名和密码重定向到主页

Cake php无法登录“错误的用户名和密码”

PHP登录“无效的用户名和密码”使用MySQL

不使用密码和用户名登录

Azure AD B2C - 仅使用本地帐户登录时出现无效用户名或密码错误

使用用户名和密码访问Kubernetes API

访问 Windows 服务帐户用户名/密码

如何通过Windows登录名使用用户名和密码访问Outlook Exchange Server?

登录系统,输入用户名和密码后登录

VNC访问的登录用户名和密码是什么

curl 使用用户名密码和登录按钮登录网站

登录问题我可以使用任何用户名和密码登录

限制用户访问网页 + 用户名/密码错误提示

Powershell-使用Microsoft帐户查找用户名和密码

SqlConnection 使用 Dynamics GP 用户名和密码 -- 用户登录失败

如何使用2或3个用户名和密码以用户形式创建登录名?

Amazon Cognito使用用户名和密码登录用户

错误:无效的登录名:535-5.7.8不接受用户名和密码

输入错误的用户名和密码后,如何使脚本不崩溃?(smtplib-gmail登录)

登录失败:未知的用户名或错误的密码-服务凭据

psexec登录失败:“未知的用户名或错误的密码。”

如何创建到帐户的直接链接以使用auth0直接登录而无需用户名和密码

Flutter和Firebase-如何仅使用用户名和密码登录

我的登录用户名和密码是什么?

什么是Grafana登录页面默认的用户名和密码?

ssh登录和git pull询问用户名/密码

登录时QuickFixJ Initiator设置用户名和密码