The passcode can be fixed by booting to dfu mode and reflashing the device. For the Apple ID you are stuck unless you have an original proof of purchase or the Apple ID is yours.
Anyone can factory wipe an iphone - this will remove all data on the phone along with passcode. But if it was linked to an iCloud account, the activation lock will remain, and you will need the password to re-setup the phone.
Cozmo85 t1_jach4nv wrote
The passcode can be fixed by booting to dfu mode and reflashing the device. For the Apple ID you are stuck unless you have an original proof of purchase or the Apple ID is yours.