Assuming you already have a valid apple id (which I recall one has to have for an iPhone), follow these directions:
Open itunes.
Go to "Store" along the top tabs.
Select "Authorize computer..."
Give it your Apple ID.
In theory, things should work then.