Why you do not want to use database. You can use file then, but it will be possible to read file
even if you encripted password. For example 5f4dcc3b5aa765d61d8327deb882cf99 is encripted word "passsword". Use database. it is better.
You can download complete php application with security implemented.
go to http://www.configure-all.com/fusebox.php
and download exam.zip file