Author's code is vulnerable to timing attacks and probably others as well.
This is why people should use established backend frameworks such as Laravel/Django/Rails if they really want to focus on their product and not on reinventing the square wheel.