[eluser]Rok Biderman[/eluser]
Hello Marcone and welcome to the CI forums. There are 3 things about this that strike me as odd.
You say the submit is redirecting you to the same page
Code:
<?=form_open('c_loginsyslogin/index/', $attributes)?>
It's exactly what it should do, you have to make an action to a different controller/method if you want that. But that is ok in my view.
Secondly, the script exits here,
so you have to remove the exit command if you want further processing.
And last, you redirect to c_/index (which is a protected page I assume) only if the user doesn't exist. If you want a redirect when there is a valid user, you need to put it here and delete the one from else part.
Code:
if(array_key_exists($user_name, $user_credentials))
{
// continue processing form, i'm just redirecting
redirect('c_/index/');
}
If you make these 3 changes, it only redirects if the username is valid, if the input is present it just says 'para' (probably for your debugging) and sets the message.
I just wanted to add that if you do it like this, you will need to build 2 separate processings for something that can be done in one as efficiently. You already check if the username (array_key) is present. Now you will have to do it once more for the user and pass matching. I don't know the rest of your code, but it seems redundant.