Welcome Guest, Not a member yet? Register   Sign In
CI keeps ignoring my coding now i am going mental
#1

[eluser]steel_slasher[/eluser]
ok basically i modded the session lib so that it would check if the email and password in the cookie are valid so i added a few lines which have a SQL query which checks for the information given then checks them in an if statement heres the code:
Code:
if(isset($session['email'])){
                $query = $this->CI->db->query("SELECT * FROM `cookies` WHERE `email` = '{$session['email']}' AND `password` = '{$session['password']}'");
                foreach ($query->result() as $row)
                {
                    $email=$row->email;
                    $password=$row->password;
                }
                if($email!==$session['email']){
                $this->sess_destroy();
                return FALSE;
                }
                if($password!==$session['password']){
                $this->sess_destroy();
                return FALSE;
                }

                }

i also made another mod where the session lib checks the cookie for a "forget" value and then checks if the cookie has been expired after a given time in a custom config value

Code:
$expiration = $this->CI->config->item('sess_expiration');
        if(isset($session['forget']))
        $expiration = $this->CI->config->item('sess_expiration_forget');
        if (is_numeric($expiration))
        {
            if ($expiration > 0)
            {
                $this->sess_length = $this->CI->config->item('sess_expiration');
            }
            else
            {
                $this->sess_length = (60*60*24*365*2);
            }
        }

the real problem is that no matter what the email and password check fails and the forget value is never set because the email and password check fails. I NEED HELP!!!!!!!!
#2

[eluser]sikkle[/eluser]
Humm your password on session ?,

let the session lib alone i think, build your auth controller, and do your stuff there.

good luck!
#3

[eluser]steel_slasher[/eluser]
i might do that as that is a solution in itself but the idea of having to rewrite the entire code again. But is the code i gave perfectly fine because i doubt it is
#4

[eluser]Crimp[/eluser]
You're starting out on the wrong track and you'll end up causing yourself trouble.

It best to only modify the core CI libraries as a very last resort. And instead of changing a library, you can extend it with your own. See the user guide for CI for info.

In this case, search the Ignited Code section of this forum for auth libraries. There are several. You can use those or take the code as a starting point for your own.
#5

[eluser]steel_slasher[/eluser]
thanks it just sounded like a smart idea to edit the core libraries but now i see it was wrong




Theme © iAndrew 2016 - Forum software by © MyBB