note : everything going well when I try in Localhost.
注意:当我在Localhost中尝试时一切顺利。
So I have a problem when I want to call my do_login controller in my login form.
所以当我想在登录表单中调用我的do_login控制器时,我遇到了问题。
this is my controller :
这是我的控制器:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Do_login extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('login_model', '', TRUE);
}
public function index()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'email', 'trim|required');
$this->form_validation->set_rules('password', 'password', 'trim|required|callback_check_database');
if($this->form_validation->run() == FALSE)
{
$this->load->view('admin/login_view');
}
else
{
redirect('home', 'refresh');
}
}
public function check_database($password)
{
$email = $this->input->post('email', TRUE);
$result = $this->login_model->check_login($email, $password);
if($result)
{
$sess_array = array();
foreach($result as $row)
{
$sess_array = array(
'user_id' => $row->user_id,
'email' => $row->email
);
$this->session->set_userdata('logged_in', $sess_array);
}
return TRUE;
}
else
{
$this->form_validation->set_message('check_database', 'Email / Password salah');
return FALSE;
}
}
}
?>
this is my view :
这是我的看法:
<?php
$attributes = array('class' => 'form-signin', 'id' => 'myform');
echo form_open('do_login', $attributes);
?>
When I try it in Localhost, everything going well and smooth. But when I try in my web server, everytime I submit the login form, I directed into 404.
当我在Localhost中尝试它时,一切顺利而顺利。但是当我在我的网络服务器上尝试时,每次提交登录表单时,我都会进入404。
Thanks for your help :)
谢谢你的帮助 :)
1 个解决方案
#1
Check your file names Because it happens with me that different case file name was worked on localhost but not on server. So check it once.
检查您的文件名因为我发现不同的案例文件名在localhost上工作但在服务器上没有。所以检查一次。
#1
Check your file names Because it happens with me that different case file name was worked on localhost but not on server. So check it once.
检查您的文件名因为我发现不同的案例文件名在localhost上工作但在服务器上没有。所以检查一次。