'doorlock' does not name a type

Is what you posted in your first message ALL the code there is? Meaning is it the complete .ino file or did you only copy / pasted a portion of it?

If what you posted is all there is, then it definitely won't compile. If there's more, then POST THE WHOLE THING.