Can a locked iPhone be unlocked temporarily?
Can an unlocked iPhone be locked by flashing
Can an unlocked iPhone be locked by flashing
What do you mean? If it is locked to an iCloud account, then no. If it is not, you can put the iPhone into recovery mode and use iTunes or Finder to erase it, but you will lose all of your data. See more info here: If you forgot your iPhone passcode - Apple Support
Please clarify your question. You ask if a locked phone can be unlocked, then ask if an unlocked phone can be locked. What is your question?
Can a locked iPhone be unlocked temporarily?