Ticker

6/recent/ticker-posts

Custom Captcha/Image Verification in Oracle Apex - Javainhand Tutorial

Oracle APEX Tutorial - Custom Captcha/Image Verification in Oracle APEX

Add Custom Captcha/Image Verification in Oracle Apex

Hello Friends,

Today I will teach you How to Add Custom Captcha in Oracle Apex

Oracle some build-in functions to generate pictures that have random latest/number.
I have implemented this functionality on my login page.you can implement this functionality on your required page.

Please follow the below steps for implement:-

Step 1:-Go to Login Page and create a one-page item with the name of P101_CAPTCHA. Please see the below screenshot for your help.
Image Verification in Oracle Apex

Step 2:- Go To Captcha Item Properties and Post below code into Post-Text.

<div style="background-color:#FFF; border:1px solid #ececec; padding:3px;">
<img width="25" height="25",=""src="APEX_050100.wwv_flow_image_generator.get_image?p_position=1&p_sessionid=&APP_SESSION.">
<img width="25" height="25",=""src="APEX_050100.wwv_flow_image_generator.get_image?p_position=2&p_sessionid=&APP_SESSION.">
<img width="25" height="25",=""src="APEX_050100.wwv_flow_image_generator.get_image?p_position=3&p_sessionid=&APP_SESSION.">
<img width="25" height="25",=""src="APEX_050100.wwv_flow_image_generator.get_image?p_position=4&p_sessionid=&APP_SESSION.">
<img width="25" height="25",=""src="APEX_050100.wwv_flow_image_generator.get_image?p_position=5&p_sessionid=&APP_SESSION.">
</div>

After using the above code and you can see the result on the screenshot.
Custom Captcha In Oracle Apex
Step 3 Use the below code for verifying the captcha.

DECLARE
   vCount   NUMBER := 0;
BEGIN
      IF TRIM (:P101_CAPTCHA) IS NULL
      THEN
         RAISE_APPLICATION_ERROR (-20001,
                                  'Please Confirm Verification Code.');
      END IF;

      BEGIN
         SELECT 1
           INTO vCount
           FROM APEX_050100.wwv_flow_request_verifications
          WHERE SESSION_ID = :APP_SESSION
           AND VERIFICATION_STRING= :P101_CAPTCHA;

               -- AND SUBSTR (VERIFICATION_STRING, 1, 5) = :P101_CAPTCHA;
      EXCEPTION
         WHEN OTHERS
         THEN
            RAISE_APPLICATION_ERROR (-20001,
                                     'Please Confirm Verification Code.');
      END;

      IF vCount=1
      THEN
         NULL;
      ELSE
         RAISE_APPLICATION_ERROR (-20001,
                                  'Please Confirm Verification Code.');
      END IF;
END;

Step 4:- For Show Error Use #SQLERRM_TEXT# In Process Error Message.

In this code, if wwv_flow_request_verifications table is not found then grant this table to the user otherwise it will give an error.


           Note:-This will not be worked on apex.oracle.com.

           You can also watch this implementation on the below link.




If You Like This Tutorial Please Like Share And Comment.

Post a comment

0 Comments