I am using cloudflare with codeigniter framework and I am facing strange problem while trying to redirect the script to another page when the action is completed, server use to throw error 520(cloudflare server)
$input = $this->input->post();
if(!empty($input)){
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'required|email');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == TRUE)
{
$r = $this->userModel->login($input["email"], $input["password"]);
if($r["success"] == "t"){
$this->userModel->setSession($r["_user_id"], $r["token"]);
//Both redirect methods does not works
//echo '<html><head><META http-equiv="refresh" content="0;URL='.$this->glob->exec_redirect().'"></head><body></body></html>';
redirect($this->glob->exec_redirect());
die();
}else{
$data["errors"] = $r["message"];
}
}else
$data["errors"] = validation_errors();
}
$this->load->view("user/login", $data);
This script work fine without cloudflare, also the script work fine with cloudflare without redirect functions. Demos:
user: test
pass: test12
Sometimes you should try more then once to crash
Works fine, user is logged in just have to redirect Manuel.
Regards.