Require specific access for certain pages with only one input field For certain pages i have to require a login first (custom form with 1 input field).


When you try to reach the URL of one of those pages you are
redirected to a login-page
They have to fill-in a number of 11 digits. If the filled in field
contains 11 digits they are redirected to the protected page(s).


It's not an age gate. It's for doctors the have to fill in a 11-digit code. If the code contains 11 digital characters they can see the protected page(s).

How (which modules) are best practices to built this functionality?
so the characters can be random or need to be verified against some database table entries?

best thing would be to have a custom code/solution for this, use ctools popup and custom javascript to check for the right cookies on the selected pages, we can add a field defining the setting whether the page requires verification or not, and overridden node tpl (template) for that particular content type which can contain drupal_add_js or inline javascript based on the field condition. Adding a module and customising will add more pain in my opinion.