I am building a referring system. And the referred person is sent out a URL via mail containing the email of the person who referred him. This email is just for the sake of mailing a thank you email each time the referred person visits my site. Now this script has a basic flaw that it does not know it's the visitors first visit or his 31st... so it sends out a mail each time the referred person visits my site,... which is a pain in the ass for me and the person who referred him in the first place. So If want this script to recognize a person and don't send an email after the initial visit, and I also know that this can be done using cookies and IF structures, like creating a cookie using the referrer's email and checking for it's existense before sending the mail... But I don't know how to code this!!!
Can you please give me complete example of thios IF Statement together with setting the cookie and looking for it's existense vis IF...