What happens when you plug your iPhone, iPad or other iOS device into someone else's computer largely depends on whether that person has iTunes installed on his computer, and whether he has the automatic device syncing feature enabled. Even if your iPhone syncs with another account, it can be restored by reconnecting it with your computer, or by restoring from your iCloud backup.
Video of the Day
Computer Without iTunes
If you have connected your iPhone to a computer that doesn't have iTunes installed, you may be prompted to install iTunes. If this happens, you can cancel the request and your iPhone will charge, just as it would if connected to your home computer. If you're not prompted to install iTunes, your iPhone will charge normally.
Computer With iTunes
Whenever you connect to a computer with iTunes installed, you run the risk of syncing your iPhone to that computer's iTunes account. If the computer has automatic syncing enabled, your iPhone will begin syncing after it's recognized by the computer. Computers that have disabled automatic syncing will prompt you before syncing new account data to your iPhone.
Disabling Automatic Syncing
Disabling the automatic syncing feature on iTunes prior to connecting your phone to a foreign computer can prevent your phone from syncing with someone else's data. To disable automatic syncing, launch iTunes before connecting your iPhone to the computer. In iTunes, click "Edit" then "Preferences" and choose the "Devices" option. Select the check box next to the option labeled "Prevent iPods, iPhones, and iPads from syncing automatically," and then click "OK" and close iTunes. This setting will prompt you and ask if you want to sync your iPhone to the computer.
Restoring From Backup
In the event that you have accidentally synced your iPhone with another user's computer, you can restore your phone back to it's previous settings by restoring via iTunes or iCloud. To restore your iPhone with iTunes, first connect your iPhone to your computer and then select your iPhone in the Devices menu. After selecting your iPhone, click the "Summary" tab, then the "Restore Backup" button. If you have previously synced with iCloud, you must first reset your phone. Click "Settings | General | Reset | Erase All Content and Settings." Your iPhone will take several moments to reset. Once complete, select the option to "Restore from iCloud Backup" and enter your Apple ID and password when prompted.