Simple Facebook convas app (who likes page and simple form)

I need very simple Facebook application (convas app - PHP SDK) - I have already created "frame" and you will only need to tell me which Canvas URL I set (or I can provide some FTP where you can code) and do a few things (no design needed):

1) check if user who came to app liked specific page (is fan of some page)

2) if he is not fan he is redirected to some page

3) if he is fan he gets shown some simple form where he writes some message and sends it

Example of form:

<form...>

<input name="message" type="text">

<input type="Submit" name="Submit" value="Submit" />

</form>

4) after he submits form (POST), his message is appended in some txt file (simply with fputs) along with his UID and then he gets message shown in app - "Your message [his message goes here] is saved".