created logic layer for server PHP