[eluser]amw_drizz[/eluser]
~Gah Rips hair out of head~
I have this issue!! Worked fine in CI 1.6.2 (before I updated straight to 1.7.0)
This is part of my login script This USED TO WORK but since I updated to 1.7.0 I have not been able to get it to work. I have even tried removing
ALL output to the browser and I still get the same error. I am going to convert back to 1.6.2 since that did work. Hope that helps for code samples of causing an error
Error
Code:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at D:\WebServer\htdocs\xterm\system\application\main_site\controllers\auth.php:18)
Filename: libraries/Session.php
Line Number: 662
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_Control {
function __construct(){
$this->load->database();
$this->load->library('parser');
$this->load->helper('url');
$this->load->library('session');
$this->load->library('user_agent');
$this->load->library('validation');
$this->load->library('encrypt');
$this->load->library('email');
//$this->load->library('themechooser');
$this->load->helper(array('form', 'url'));
}
// Auth Segments
function doLogin(){
$rules['username'] = "callback_isreg|required|xss_clean";
$rules['password'] = "required";
$fields['username'] = "Username";
$fields['password'] = "Password";
$this->validation->set_fields($fields);
$this->validation->set_rules($rules);
$this->validation->set_error_delimiters('<div id="error" class="error">', '</div>');
if($this->validation->run() == FALSE ){
$this->load->view('auth/login');
}
else{
$this->VerifyAuth();
}
}
function VerifyAuth(){
$post_array = array(
'username' => $this->input->post('username', TRUE),
'password' => md5($this->input->post('password')),
);
$query = $this->db->query("SELECT * FROM users WHERE username='". $post_array['username'] ."'");
$row = $query->row_array();
if($row['password'] !== $post_array['password']){
/*
This is/was for debugging to find out why passwords were not set right
if($this->config->item('debug') == TRUE){
echo "PWD in DB = ". $row['password'] ."\n";
echo "PWD Received is ". $post_array['password'] ."\n";
}
else{ */
//show_error('Incorrect Password Try again');
$data['strike'] = 0;
$data['limit'] = 0;
echo $this->parser->parse("auth/invalid",$data,true);
// }
}
elseif($row['active'] == 'no'){
show_error('Your account is currently disabled, Please contact the site Admin by <a href="'. site_url('messaging/unreg/admin') .'">Clicking here</a>');
}
else{
$logged_array = array(
"username" => $row['username'],
"lvl" => $row['lvl'],
'uid' => $row['id'],
'loggedin' => TRUE,
);
$this->session->set_userdata($logged_array);
redirect('/members', 'refresh');
}
}
Maybe I am too stupid to get it working on 1.6.2 as well. But I do know it did work, but I am reworking the templating system on my site and it died on me.