added the php file and made small bug fixes