ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

DX Auth 1.0.6 (Authentication library)

December 01, 2008 6:14am

Subscribe [160]
  • #361 / Feb 23, 2009 12:29pm

    Sparta

    9 posts

    I had some problem with DX_Auth lib last night. I don;t know why but in my localhost wamp everything works but in my hosting not works and I must to disable some commands and function, I think it has some problem with PHP4, also after some searches it shows everytime error in this command line:

    $query->num_rows()

    the last error was in thin function:

    function is_max_login_attempts_exceeded()
        {
            $this->ci->load->model('dx_auth/login_attempts', 'login_attempts');
            return $this->ci->login_attempts->check_attempts($this->ci->input->ip_address()->num_rows()>= $this->ci->config->item('DX_max_login_attempts'));
        }

    and as you see there we have that num_rows again.
    it would be highly appreciate d if you help me in this matter

    best regards
    Sparta

  • #362 / Feb 23, 2009 12:33pm

    Spir

    139 posts

    What is the error? And what are both MySQL version?

  • #363 / Feb 23, 2009 12:43pm

    Sparta

    9 posts

    Server version: 5.0.41-community-log
    and the error is:

    Fatal error: Cannot redeclare is_max_login_attempts_exceeded() in /hsphere/local/home/sparta/bregsm.org/rapidshare/system/application/libraries/DX_Auth.php on line 802

  • #364 / Feb 23, 2009 12:46pm

    Sparta

    9 posts

    the main error before I touch anything was:
    Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /hsphere/local/home/sparta/bregsm.org/rapidshare/system/application/libraries/DX_Auth.php on line 803

    Best regards
    Sparta

  • #365 / Feb 23, 2009 4:21pm

    Sparta

    9 posts

    I changed these line 803 in DX_Auth Lib:

    return ($this->ci->login_attempts->check_attempts($this->ci->input->ip_address())->num_rows() >= $this->ci->config->item('DX_max_login_attempts'));

    to this:

    $query = $this->ci->login_attempts->check_attempts($this->ci->input->ip_address());
            return $query->num_rows() >= $this->ci->config->item('DX_max_login_attempts');

    and these line 1092 of the lib:

    $user_id = $query->row()->id;

    to this:

    $query = $query->row();
                $user_id = $query->id;

    now the script can be loaded but when trying to login it gives again the following error:

    Fatal error: Call to a member function on a non-object in /hsphere/local/home/.../system/application/libraries/DX_Auth.php on line 802

    please guys I can’t understand it please help pro’s

    Best Regards
    Sparta

  • #366 / Feb 23, 2009 4:40pm

    Spir

    139 posts

    Could you debug query? It seems query is not an object for some reason. DB issue or smthing else?
    I’m a noob like you, trying to help.

  • #367 / Feb 23, 2009 4:43pm

    Sparta

    9 posts

    but you are really help full dear friend

    but I don’t know how to debug this for db errors

    Sparta

  • #368 / Feb 23, 2009 4:49pm

    Sparta

    9 posts

    My last error:

    return $query->num_rows() >= $this->ci->config->item('DX_max_login_attempts');

    that I changed it to:

    return $query->num_rows >= $this->ci->config->item('DX_max_login_attempts');

    but still I have errors like before

    Sparta

  • #369 / Feb 23, 2009 4:51pm

    Spir

    139 posts

    add this lib to your lib direcory. load it then do this : vd::dump($yourVar); and see the magic.

    lib :

    <?php
    /**
     * VAR DUMP plus
     */
    class vd {
        function dump ($var, $name = '') {
            $style = "background-color: whitesmoke; padding: 8px 8px 8px 8px; border: 1px solid black; text-align: left;";
            echo "<pre>" .
                ($name != '' ? "$name : " : '') .
                vd::_get_info_var ($var, $name) .
                "</pre><p>“;<br />
        }<br />
        <br />
        function get ($var, $name = ‘’) {<br />
            return ($name != '' ? "$name : " : '') . vd::_get_info_var ($var, $name);<br />
        }<br />
        <br />
        function _get_info_var ($var, $name = ‘’, $indent = 0) {<br />
            static $methods = array ();<br />
            $indent > 0 or $methods = array ();</p>
    
    <p>        $indent_chars = '  ';<br />
            $spc = $indent > 0 ? str_repeat ($indent_chars, $indent ) : '';<br />
            <br />
            $out = '';<br />
            if (is_array ($var)) {<br />
                $out .= "<span><b>Array</b></span> " . count ($var) . " (\n";<br />
                foreach (array_keys ($var) as $key) {<br />
                    $out .= "$spc  [<span>$key</span>] => ";<br />
                    if (($indent == 0) && ($name != '') && (! is_int ($key)) && ($name == $key)) {<br />
                        $out .= "LOOP\n";<br />
                    } else {<br />
                        $out .= vd::_get_info_var ($var[$key], '', $indent + 1);<br />
                    }<br />
                }<br />
                $out .= “$spc)”;<br />
            } else if (is_object ($var)) {<br />
                $class = get_class ($var);<br />
                $out .= "<span><b>Object</b></span> $class";<br />
                $parent = get_parent_class ($var);<br />
                $out .= $parent != '' ? " <span>extends</span> $parent" : '';<br />
                $out .= " (\n";<br />
                $arr = get_object_vars ($var);<br />
                while (list($prop, $val) = each($arr)) {<br />
                    $out .= "$spc  " . "-><span>$prop</span> = ";<br />
                    $out .= vd::_get_info_var ($val, $name != '' ? $prop : '', $indent + 1);<br />
                }<br />
                $arr = get_class_methods ($var);<br />
                $out .= “$spc  ” . “$class methods: ” . count ($arr) . ” “;<br />
                if (in_array ($class, $methods)) {<br />
                    $out .= "[already listed]\n";<br />
                } else {<br />
                    $out .= "(\n";<br />
                    $methods[] = $class;<br />
                    while (list($prop, $val) = each($arr)) {<br />
                        if ($val != $class) {<br />
                            $out .= $indent_chars . "$spc  " . "->$val();\n";<br />
                        } else {<br />
                            $out .= $indent_chars . "$spc  " . "->$val(); [<b>constructor</b>]\n";<br />
                        }<br />
                    }<br />
                    $out .= “$spc  ” . “)\n”;<br />
                }<br />
                $out .= “$spc)”;<br />
            } else if (is_resource ($var)) {<br />
                $out .= "<span><b>Resource</b></span> [" . get_resource_type($var) . "] ( <span>" . $var . "</span> )";<br />
            } else if (is_int ($var)) {<br />
                $out .= "<span><b>Integer</b></span> ( <span>" . $var . "</span> )";<br />
            } else if (is_float ($var)) {<br />
                $out .= "<span><b>Float</b></span> ( <span>" . $var . "</span> )";<br />
            } else if (is_numeric ($var)) {<br />
                $out .= "<span><b>Numeric string</b></span> " . strlen($var) . " ( \"<span>" . $var . "</span>\" )";<br />
            } else if (is_string ($var)) {<br />
                $out .= '<span><b>String</b></span> ' . strlen($var) . ' ( "<span>' . nl2br(htmlentities($var)) . '</span>" )';<br />
            } else if (is_bool ($var)) {<br />
                $out .= "<span><b>Boolean</b></span> ( <span>" . ($var ? 'True' : 'False') . "</span> )";<br />
            } else if (! isset ($var)) {<br />
                $out .= "<b>Null</b>";<br />
            } else {<br />
                $out .= "<b>Other</b> ( " . $var . " )";<br />
            }<br />
            <br />
            return $out . “\n”;<br />
        }<br />
    }<br />
    ?>
    </pre>

  • #370 / Feb 23, 2009 5:35pm

    Sparta

    9 posts

    can you please give me controler and view file for this lib?
    or an instruction for use?

    Sparta

  • #371 / Feb 24, 2009 4:11am

    Spir

    139 posts

    it’s a standalone file. You just need to load it and execute vd:dump($youVarHere); like I previously said.

  • #372 / Feb 24, 2009 5:19pm

    Sparta

    9 posts

    hello

    still have problems and no answer here

    best regards

    Sparta

  • #373 / Feb 24, 2009 5:24pm

    Spir

    139 posts

    did you only try to debug like I said?

  • #374 / Feb 24, 2009 5:26pm

    Sparta

    9 posts

    no dear friend I can’t use it

    I think I am so stupid but can’t run it on.

    but the matter is this DX_Auth script works fine on my local machine.

    Besr Regards

  • #375 / Feb 26, 2009 3:43pm

    CroNiX

    4713 posts

    Ive been wrapping my head around this library and for the most part I like it.  One thing I would suggest is that when someone tries to login with an incorrect username, that you don’t report that to the user - “Username not exist.”.  The same goes for the password being wrong with the correct username supplied - “Your password was incorrect.”.  This just makes it easier for hackers by letting them know where to focus their efforts.  A better message is “Your username or password are incorrect” or something similar, for both cases.  I know you are using captcha as a backup, but this is getting easier to defeat with advancements in on-screen OCR.

    Just my .02

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases