what you are reffering to is liking a page beofore being able to interact with an application that has been embedded into a page. A page tab app.
You need to parse the signed_request that facebook passes to your application and once you have parsed it you will be able to see if the user has liked your page or not.
Here is a link to some more information about singed_requests