Here's several Apple Support articles on codes or Activation locks ... whatever is relevant to you ...
iOS: Forgot Passcode or Device Disabled
http://support.apple.com/kb/ht1212
iOS Passcodes
http://support.apple.com/kb/ht4113
Find My iPhone, iPad, iPod Touch or Mac
https://www.apple.com/support/icloud/find-my-device/
Find My iPhone Activation Lock
http://support.apple.com/kb/HT5818
Find My iPhone Activation Lock: Removing a Device from a Previous Owner's Account
http://support.apple.com/kb/ts4515
Apple release Tool to check the Activation Lock Status of iOS Devices
http://www.idownloadblog.com/2014/10/01/activation-lock-status-check/
What to do before Selling or Giving Away your iPhone, iPad or iPod Touch
http://support.apple.com/kb/ht5661