Is there anyway to code a database of somekind so people can only come into server if they r a registered nickname?

like when they open mIRC it will say either Register and once they have it says Log In?

if they register, it just says log in everytime they open mirc?

is this possible, if so cud u tell me a code or show me where i can learn to do it myself?