updated validation on newagent

updated validation on newagent and moving in one php