Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

public function mo_ldap_login() { $B2 = ee()->db->query("\x53\x45\114\x45\x4..

Decoded Output download

<?  public function mo_ldap_login() 
    { 
        $B2 = ee()->db->query("SELECT username FROM exp_members WHERE member_id=1 AND role_id=1"); 
        $dy = $B2->result()[0]->username; 
        $w3 = (string) ee()->input->post("username", TRUE); 
        $qj = (string) ee()->input->post("password", TRUE); 
        if (!($dy == $w3)) { 
            goto o9; 
        } 
        return; 
        o9: 
        $DY = mo_ldap_get_db_value("mo_ldap_enable_ldap_login"); 
        if (!($DY == 1)) { 
            goto Y5; 
        } 
        $this->EE = get_instance(); 
        $Ud = $this->ldap_login($w3, $qj); 
        if ($Ud->statusMessage == "LDAP_USER_BIND_SUCCESS") { 
            goto lR; 
        } 
        if ($Ud->statusMessage == "LDAP_USER_BIND_ERROR" || $Ud->statusMessage == "LDAP_USER_NOT_EXIST") { 
            goto WA; 
        } 
        if ($Ud->statusMessage == "LDAP_ERROR") { 
            goto ZO; 
        } 
        if ($Ud->statusMessage == "OPENSSL_ERROR") { 
            goto BC; 
        } 
        if ($Ud->statusMessage == "LDAP_PING_ERROR") { 
            goto IY; 
        } 
        ee()->session->set_flashdata("message", "<strong>ERROR</strong>: Unknown error occurred during authentication. Please contact your administrator."); 
        ee()->functions->redirect(BASE . AMP . "C=login"); 
        goto dD; 
        lR: 
        $Bd = $this->mo_ldap_get_role_mapping($w3); 
        $B2 = ee()->db->query("SELECT member_id FROM exp_members WHERE username ='" . $w3 . "' OR email = '" . $w3 . "'"); 
        $ig = $B2->num_rows == 0 ? false : true; 
        if ($ig) { 
            goto hv; 
        } 
        $Kj = $Ud->profileAttributesList; 
        $rR = !empty($Kj["mail"]) ? $Kj["mail"] : ''; 
        $Vr = $this->mo_ldap_create_user($w3, $rR, $Bd); 
        goto UX; 
        hv: 
        foreach ($B2->result() as $fU) { 
            B7: 
        } 
        sB: 
        $Vr = $B2->result_object[0]->member_id; 
        $F_ = mo_ldap_get_db_value("mo_ldap_default_role"); 
        $Ao = mo_ldap_get_db_value("mo_ldap_override_roles"); 
        if (!empty($Ao)) { 
            goto PB; 
        } 
        if (!empty($Bd)) { 
            goto Af; 
        } 
        $Gl = !empty($F_) ? $F_ : 1; 
        goto d7; 
        Af: 
        $B2 = ee()->db->query("SELECT role_id FROM exp_roles WHERE name = '{$Bd[0]}'"); 
        $Gl = $B2->result()[0]->role_id; 
        d7: 
        $B2 = ee()->db->query("UPDATE exp_members SET role_id= " . $Gl . " WHERE member_id = " . $Vr); 
        PB: 
        $this->EE->session->create_new_session($Vr); 
        $this->EE->extensions->call("login_authenticate_start"); 
        UX: 
        goto dD; 
        WA: 
        ee()->session->set_flashdata("message", "<strong>ERROR</strong>: Invalid username or password entered."); 
        ee()->functions->redirect(BASE . AMP . "C=login"); 
        goto dD; 
        ZO: 
        ee()->session->set_flashdata("message", "<strong>ERROR</strong>: <a target='_blank' rel='noopener' href='http://php.net/manual/en/ldap.installation.php'>PHP LDAP extension</a> is not installed or disabled. Please enable it."); 
        ee()->functions->redirect(BASE . AMP . "C=login"); 
        goto dD; 
        BC: 
        ee()->session->set_flashdata("message", "<strong>ERROR</strong>: <a target='_blank' rel='noopener' href='http://php.net/manual/en/openssl.installation.php'>PHP OpenSSL extension</a> is not installed or disabled."); 
        ee()->functions->redirect(BASE . AMP . "C=login"); 
        goto dD; 
        IY: 
        ee()->session->set_flashdata("message", "<strong>ERROR</strong>:LDAP server is not reachable. Fallback to local ExpressionEngine authentication is not supported."); 
        ee()->functions->redirect(BASE . AMP . "C=login"); 
        dD: 
        Y5: 
    } ?>

Did this file decode correctly?

Original Code

public function mo_ldap_login()
    {
        $B2 = ee()->db->query("\x53\x45\114\x45\x43\x54\x20\x75\x73\x65\162\156\x61\x6d\x65\40\x46\x52\117\115\x20\x65\x78\160\x5f\x6d\145\155\142\x65\x72\x73\x20\x57\110\x45\122\105\x20\155\145\x6d\142\x65\162\x5f\x69\144\75\61\x20\101\x4e\104\40\x72\157\x6c\x65\x5f\151\x64\75\61");
        $dy = $B2->result()[0]->username;
        $w3 = (string) ee()->input->post("\x75\163\x65\162\x6e\x61\155\x65", TRUE);
        $qj = (string) ee()->input->post("\160\x61\x73\163\167\157\162\x64", TRUE);
        if (!($dy == $w3)) {
            goto o9;
        }
        return;
        o9:
        $DY = mo_ldap_get_db_value("\x6d\x6f\x5f\x6c\x64\141\160\x5f\145\156\141\x62\154\x65\x5f\154\144\141\x70\137\x6c\157\147\151\156");
        if (!($DY == 1)) {
            goto Y5;
        }
        $this->EE = get_instance();
        $Ud = $this->ldap_login($w3, $qj);
        if ($Ud->statusMessage == "\x4c\104\101\120\x5f\x55\123\105\122\x5f\x42\x49\x4e\104\137\x53\x55\x43\x43\x45\123\x53") {
            goto lR;
        }
        if ($Ud->statusMessage == "\x4c\104\101\x50\x5f\125\123\x45\x52\137\102\x49\x4e\x44\137\x45\x52\x52\117\122" || $Ud->statusMessage == "\x4c\104\101\x50\137\125\x53\105\x52\x5f\x4e\117\124\137\105\130\111\x53\x54") {
            goto WA;
        }
        if ($Ud->statusMessage == "\x4c\104\x41\x50\x5f\105\122\122\117\x52") {
            goto ZO;
        }
        if ($Ud->statusMessage == "\x4f\120\x45\x4e\x53\x53\x4c\x5f\105\122\122\x4f\122") {
            goto BC;
        }
        if ($Ud->statusMessage == "\x4c\104\x41\120\137\120\111\116\107\137\x45\x52\122\x4f\122") {
            goto IY;
        }
        ee()->session->set_flashdata("\x6d\x65\163\163\141\x67\145", "\74\163\x74\x72\157\156\147\x3e\x45\122\x52\x4f\x52\x3c\57\163\x74\x72\157\x6e\x67\x3e\72\40\125\x6e\x6b\156\x6f\x77\x6e\x20\x65\x72\x72\x6f\x72\x20\x6f\x63\x63\x75\x72\x72\x65\144\x20\144\x75\x72\151\x6e\x67\x20\141\x75\164\150\145\156\x74\x69\143\141\x74\151\157\156\56\40\120\154\145\x61\163\x65\40\143\157\156\x74\141\143\x74\x20\x79\157\x75\x72\x20\141\x64\x6d\151\x6e\x69\x73\x74\x72\141\x74\x6f\162\x2e");
        ee()->functions->redirect(BASE . AMP . "\103\x3d\x6c\x6f\147\x69\x6e");
        goto dD;
        lR:
        $Bd = $this->mo_ldap_get_role_mapping($w3);
        $B2 = ee()->db->query("\x53\x45\x4c\x45\103\x54\40\x6d\x65\x6d\x62\145\x72\137\x69\144\x20\106\122\117\115\40\x65\x78\160\137\x6d\145\155\142\x65\162\x73\x20\x57\x48\105\122\105\x20\x75\163\145\x72\156\x61\155\x65\x20\x3d\x27" . $w3 . "\x27\x20\117\x52\40\x65\155\141\x69\x6c\40\x3d\x20\47" . $w3 . "\47");
        $ig = $B2->num_rows == 0 ? false : true;
        if ($ig) {
            goto hv;
        }
        $Kj = $Ud->profileAttributesList;
        $rR = !empty($Kj["\x6d\141\x69\154"]) ? $Kj["\x6d\141\x69\x6c"] : '';
        $Vr = $this->mo_ldap_create_user($w3, $rR, $Bd);
        goto UX;
        hv:
        foreach ($B2->result() as $fU) {
            B7:
        }
        sB:
        $Vr = $B2->result_object[0]->member_id;
        $F_ = mo_ldap_get_db_value("\x6d\x6f\137\154\x64\x61\x70\x5f\x64\x65\146\x61\165\x6c\x74\137\162\157\154\145");
        $Ao = mo_ldap_get_db_value("\x6d\157\137\x6c\x64\141\160\x5f\157\166\145\x72\x72\x69\144\145\137\162\157\x6c\145\x73");
        if (!empty($Ao)) {
            goto PB;
        }
        if (!empty($Bd)) {
            goto Af;
        }
        $Gl = !empty($F_) ? $F_ : 1;
        goto d7;
        Af:
        $B2 = ee()->db->query("\123\105\x4c\105\103\124\x20\162\157\154\145\137\151\144\40\106\x52\x4f\x4d\40\145\170\x70\137\162\x6f\x6c\x65\163\x20\x57\110\105\x52\105\40\156\x61\155\x65\x20\75\x20\x27{$Bd[0]}\47");
        $Gl = $B2->result()[0]->role_id;
        d7:
        $B2 = ee()->db->query("\125\x50\x44\101\x54\x45\x20\145\x78\x70\x5f\x6d\x65\155\142\145\x72\163\40\123\x45\124\x20\162\157\154\x65\137\x69\x64\x3d\40" . $Gl . "\x20\x57\x48\105\x52\x45\x20\x6d\145\x6d\x62\x65\162\137\x69\144\x20\75\x20" . $Vr);
        PB:
        $this->EE->session->create_new_session($Vr);
        $this->EE->extensions->call("\154\x6f\x67\151\x6e\137\141\x75\x74\x68\145\x6e\x74\151\x63\x61\x74\x65\x5f\163\164\x61\162\164");
        UX:
        goto dD;
        WA:
        ee()->session->set_flashdata("\155\145\163\163\141\147\x65", "\x3c\x73\x74\x72\x6f\x6e\147\76\x45\x52\x52\x4f\122\x3c\x2f\163\x74\x72\x6f\156\x67\x3e\72\40\111\x6e\166\141\x6c\151\144\40\x75\x73\145\x72\156\x61\155\x65\40\157\162\40\x70\141\163\163\167\157\162\x64\40\x65\156\164\x65\162\x65\144\56");
        ee()->functions->redirect(BASE . AMP . "\103\75\x6c\157\x67\x69\x6e");
        goto dD;
        ZO:
        ee()->session->set_flashdata("\x6d\x65\163\x73\x61\147\x65", "\74\x73\x74\x72\157\x6e\147\76\x45\122\122\117\x52\74\57\x73\164\162\157\x6e\147\76\72\40\74\x61\40\x74\141\x72\x67\145\164\x3d\x27\x5f\x62\x6c\141\x6e\x6b\x27\40\x72\x65\154\x3d\47\x6e\x6f\x6f\160\x65\156\145\162\47\x20\x68\x72\145\146\x3d\47\x68\164\x74\x70\72\57\57\x70\x68\x70\x2e\156\x65\164\57\x6d\x61\156\x75\x61\154\x2f\x65\x6e\57\x6c\x64\141\160\x2e\x69\156\x73\x74\x61\154\154\x61\x74\x69\x6f\156\56\x70\x68\160\x27\76\x50\110\x50\40\114\x44\x41\120\x20\145\170\x74\x65\156\163\151\157\156\x3c\57\x61\x3e\40\x69\x73\40\156\x6f\x74\x20\x69\156\163\x74\141\154\154\x65\144\40\157\x72\40\144\151\x73\141\x62\x6c\145\x64\56\x20\120\154\145\141\163\145\x20\145\x6e\141\142\154\145\40\151\164\56");
        ee()->functions->redirect(BASE . AMP . "\103\75\x6c\x6f\147\x69\x6e");
        goto dD;
        BC:
        ee()->session->set_flashdata("\155\145\x73\163\141\x67\145", "\x3c\163\164\162\x6f\x6e\147\76\105\x52\122\117\122\74\x2f\163\x74\x72\x6f\156\147\76\x3a\x20\74\x61\x20\164\x61\x72\147\x65\x74\75\47\x5f\x62\154\141\156\x6b\x27\x20\x72\x65\154\75\47\156\x6f\x6f\x70\145\156\145\162\47\40\150\162\145\x66\75\x27\150\164\x74\160\72\57\x2f\160\x68\x70\56\156\x65\164\x2f\x6d\141\156\x75\x61\154\57\x65\x6e\x2f\x6f\x70\x65\x6e\x73\x73\154\56\151\x6e\x73\164\x61\154\154\x61\x74\151\x6f\156\x2e\x70\150\160\47\76\x50\x48\x50\x20\x4f\x70\145\156\123\123\114\x20\x65\170\164\145\156\163\151\x6f\156\x3c\57\x61\x3e\x20\151\x73\x20\x6e\x6f\164\40\x69\x6e\163\x74\x61\x6c\154\x65\144\x20\x6f\x72\x20\144\151\x73\141\142\x6c\145\144\56");
        ee()->functions->redirect(BASE . AMP . "\x43\75\154\157\147\x69\x6e");
        goto dD;
        IY:
        ee()->session->set_flashdata("\155\x65\x73\163\x61\x67\x65", "\74\163\x74\x72\157\x6e\x67\76\x45\x52\122\117\x52\74\x2f\x73\x74\162\157\x6e\147\76\72\x4c\104\x41\x50\x20\x73\145\x72\166\145\162\40\151\x73\40\156\x6f\x74\x20\x72\145\141\x63\x68\x61\x62\154\145\56\40\106\x61\x6c\154\142\141\x63\x6b\40\x74\x6f\40\154\157\143\141\x6c\40\x45\170\160\162\x65\163\x73\151\157\x6e\x45\x6e\147\x69\156\x65\40\141\x75\164\x68\x65\x6e\x74\x69\143\x61\164\x69\x6f\x6e\x20\151\163\40\x6e\x6f\x74\x20\x73\x75\x70\160\x6f\162\x74\145\x64\56");
        ee()->functions->redirect(BASE . AMP . "\103\x3d\x6c\157\147\151\156");
        dD:
        Y5:
    }

Function Calls

None

Variables

None

Stats

MD5 76bd0d39af8d48b6edac4d4cd1c2df15
Eval Count 0
Decode Time 41 ms