Welcome Guest, Not a member yet? Register   Sign In
Redux Authentication 1.4a (24th July 2008)

[eluser]andreagam[/eluser]
Thanks, Lizaaard, I'll try to ... downgrade :-)

I'll tell if it works.

[eluser]kvait[/eluser]
I sent some info to Popcorn regardless this issue. He should be able to figure something out and fix it.
What web server are you using CI andrea and php version?

Try using "if" statements instead of switch.

Something like that:
Code:
if($redux) {
   print 'OK';
} elseif($redux=='NOT_ACTIVATED') {
   print 'NOT_ACTIVATED';
} elseif($redux=='BANNED') {
   print 'BANNED';
} else {
   print 'FAILED';
}

[eluser]andreagam[/eluser]
Kvait, that's the trick!
In fact, it seems that when PHP is attempting to compare the string ("NOT_ACTIVATED") to an integer (1), it converts the string into an integer which ends up satisfying the first case.

So, while we're waiting for an official fix by Popcorn (that sure will be a more elegant one), we can substitute the switch statement with a series of if...

(Kvait, FYI using OSX, MAMP, CI 1.6.3 - PHP 5.2.5 - MySQL 5.0.41 )
Thanks, mates

[eluser]jimhern[/eluser]
Wow, thanks for following up. Your code was pretty much identical to mine with the exception of the view.
A series of if statements was my next step but I didn't want to muck around too much until I was sure I just hadn't missed something simple. Because that's usually the way of it.

Thanks for the input!

[eluser]lizaaard[/eluser]
if this is the problem? why i have no problem ?? Tongue

i'm running xampp and CI latest version...

and.. i've the ';' error on mi login page... but it works with no problem..

i've a super apache server and nothing fails =P or i'm missing something else?

[eluser]kvait[/eluser]
Go figure =)

I have xampplite with PHP 5.2.5

[eluser]lizaaard[/eluser]
i've xampp (no lite).. with php 5.2.5 too

this is weird

[eluser]kvait[/eluser]
Here is a fix:
Code:
switch ((string) $redux)
{
    case 'NOT_ACTIVATED':
        die('Not activated');
        break;
    case 'BANNED':
        die('Banned');
        break;
    case true:
        die('true');
        break;
    case false:
        die('false');
        break;
}

[eluser]Raiko[/eluser]
[quote author="kvait" date="1217316869"]Here is a fix:
Code:
switch ((string) $redux)
{
    case 'NOT_ACTIVATED':
        die('Not activated');
        break;
    case 'BANNED':
        die('Banned');
        break;
    case true:
        die('true');
        break;
    case false:
        die('false');
        break;
}
[/quote]

Can someone explain how the banned part works? I thought I understood it.

I created a ban notice with id 1 in the banned table. I set the banned_id field to that id for a user. I can still login fine with that user. No banned flash shows up.

Also, this fix doesn't make much sense to me. Popcorn returned the same type of data for the registration part. I get the correct message with my email activation turned on. Atleast that's how I read the code.

[eluser]kvait[/eluser]
I think query for _login() should be this:
Code:
$i = $this->ci->db->select($users_tbl.'.password, '.
                $users_tbl.'.hash, '.
                $users_tbl.'.id, '.
                $users_tbl.'.username, '.
                $users_tbl.'.activation_code, '.
                $users_tbl.'.banned_id, '.
                $banned_tbl.'.reason')
banned_id - added.

Now it works for me.




Theme © iAndrew 2016 - Forum software by © MyBB