fixed and added comments to server PHP script