a simple one would work like this
you have two numbers in your code, one is the open code, the other the lock
the user types in the key you provide
inside the program the computer adds the key to the open code number..eg
12345 +
67894=
80239
if the result is the same as the lock number then the user code was correct, so in this case the number inside your code would be 80239, in code it would be
input "enter user code";code
if code+67894=80239 then activate=1
and in the parts of your code where things are de-activated by not having the code
if select_save=1 and activate=1
save_files
else
print"you need to register before you can save files"
endif
thats simple example, in a full program you would hide the lock number and the open code by creating it from an equation, so anyone looking through your code with a hex editor couldn`t see the embedded number, and rather than just check when the save routine was called you would check during the save as well in several places and mess it up or crash the program if the activate flag was 0, also you would not use simple addition, or even just one number for the lock, you just need to think tricky.
we know where area 51 is, but where are areas 1 to 50?, and what do they do there?.