Welcome Guest, Not a member yet? Register   Sign In
Login form posting username = 0 and passord = md5 of 0 ...
#1

[eluser]jim-_-[/eluser]
I use the exact same login form on another CI site hosted on the same server

I have been trying to fix this for hours, all the same libraries and helpers are loaded.


Its just like the form never gets any info... what can be different I have done ?

The site works in every other way, there are selects that go to the database en get other things...

Model
Code:
function validate()
{  

  $this->db->where('active', TRUE);
  $this->db->where('username', $this->input->post('username'));
  $this->db->where('pass1word', md5($this->input->post('password')));
  $query = $this->db->get('membership');
  
  if($query->num_rows == 1)
  {
   return true;
  }
}

Controller
Code:
function index(){
  $data['main_content'] = 'login_form';
  $this->load->view('includes/template', $data);
}
function validate_credentials()
{
  $this->load->model('membership_model');
  $query = $this->membership_model->validate();
  
  if($query)
   {
   $data = array(
    'username' => $this->input->post('username'),
    'is_logged_in' => true
    );
    
    $this->session->set_userdata($data);
    redirect();
   }
  else
  {
    redirect($this->session->flashdata('goback'));
  }
  
}

this is the form that gives nothing
Code:
<div id="login_form">
<h1>Login doode!</h1>
// this is just to keep info for a back button later.
&lt;?php $this->session->keep_flashdata('goback');
echo form_open('login/validate_credentials');

echo form_input(array(
  'name' => 'username',
  'id' => 'username',
  'value' => '',
  'placeholder' => 'Username'
));
echo form_password(array(
  'name' => 'password',
  'id' => 'password',
  'value' => '',
  'placeholder' => 'Password'
));
echo form_submit('submit', 'Login');
?&gt;
</div>

(goes to the controller again)

returns the info below.

I put the 1 into password to get this output in the browser. other wise i just get the username or password incorrect message.
Code:
SELECT * FROM (`membership`) WHERE `active` = 1 AND `username` = 0 AND `pass1word` = 'd41d8cd98f00b204e9800998ecf8427e'


Messages In This Thread
Login form posting username = 0 and passord = md5 of 0 ... - by El Forum - 07-31-2012, 01:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB