Validate IBAN PHP

Home Forums Quform WordPress Validate IBAN PHP

This topic is: not resolved
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #32462
    studio T
    Participant

    Is it posible to insert php to validate IBAN number on input?
    Best regards,
    Marko

    #32465
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #32491
    studio T
    Participant

    Hi Ally,

    If I understood correctly with this code the input will check if the IBAN numbers are valid?
    Despite having 22 characters the validator will recognize the numbers of account? Like on example with credit card.. I attach pic if you know what i mean.

    Best regards,
    Marko

    • This reply was modified 3 years, 2 months ago by studio T.
    Attachments:
    You must be logged in to view attached files.
    #32498
    studio T
    Participant

    Hi Ally,

    One more thing. I tried to implement the code

    add_filter(‘quform_element_valid_5_37’, function ($valid, $value, Quform_Element_Field $element) { if (!preg_match(‘/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/’, $check)) {
    return false;
    }

    $country = substr($check, 0, 2);
    $checkInt = intval(substr($check, 2, 2));
    $account = substr($check, 4);
    $search = range(‘A’, ‘Z’);
    $replace = [];
    foreach (range(10, 35) as $tmp) {
    $replace[] = strval($tmp);
    }
    $numStr = str_replace($search, $replace, $account . $country . ’00’);
    $checksum = intval(substr($numStr, 0, 1));
    $numStrLength = strlen($numStr);
    for ($pos = 1; $pos < $numStrLength; $pos++) {
    $checksum *= 10;
    $checksum += intval(substr($numStr, $pos, 1));
    $checksum %= 97;
    }

    return ((98 – $checksum) === $checkInt); { $element->addError(‘The value is not Foo’); $valid = false;
    }

    return $valid;
    }, 10, 3);

    Is this right?
    My element unique ID is 5_37. This is my form link im trying to implement the IBAN validator.
    https://studiot.agency/tennisfactory/termine/tennis-club-herrsching-e-v/
    https://stackoverflow.com/questions/20983339/validate-iban-php/20983340#20983340

    I need your pro experience 🙂
    Best regards.

    #32499
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #32503
    studio T
    Participant

    Hi Ally,

    It worked excellent! Thank you for your time.
    One more thing. How to add to other forms that i have the same function?
    There unique IDs are 4_37, 3_37, 6_37, 1_37
    Same forms, different locations.

    Best regards.
    Keep up with good work!

    • This reply was modified 3 years, 2 months ago by studio T.
    • This reply was modified 3 years, 2 months ago by studio T.
    #32506
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #32507
    studio T
    Participant

    Hi Ally,

    Perfect! It worked.
    Thank you once again.

    Best regards,

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy