Tell-A-Friend Instructions
 

Below are instructions along with example HTML codes associated with the Tell-A-Friend script. To be sure everything works right follow all of the instructions in order.

Code :: Locations

Open up tellafriend.cgi in a text editor such as notepad or wordpad but not Microsoft Word.

If you script shows an error message such as 'Internal Server Error' it is most-likely because your locations are wrong or you haven't chmodded it correctly. Contact your hosting provider and ask where perl is located. Then change /usr/bin/perl to the correct location.

#!/usr/bin/perl

Also ask where sendmail is located and change /usr/sbin/sendmail to the correct location.

$mailprog = '/usr/sbin/sendmail';

If it still does not work contact us via the support page and we will help you fix it.


Code :: Security

This step is required for everything to work. Look for the below code and change your-site.com and www.your-site.com to your actual domain (website) name. One with the www. and one without it.

@alowed_sites = ("your-site.com","www.your-site.com");

You can add as many sites as you want like so.

@alowed_sites = ("your-site.com","www.your-site.com","your-site2.com","www.your-site2.com");


cgi-bin and ASCII Mode

This step is required for the script to work. Before uploading make a folder named cgi-bin. The URL should look like this (http://your-site.com/cgi-bin/). Then upload sendmail.cgi into the cgi bin folder.

When uploading the .cgi files make sure you have ASCII mode selected in your FTP software. Dreamweaver's FTP software should do this automatically.

cgi-bin may not be the correct folder name (Most likely it is correct). If the script doesn't work after you complete these instructions contact your hosting provider and ask where to put perl/cgi scripts on your server.


CHMOD 755

This step is required for the script to work on your server. After uploading the script you need to CHMOD tellafriend.cgi and include.cgi to 755. In most FTP software's this can be done by right clicking the script on your server and selecting Properties or Options. From there just look for the word CHMOD.


tellafriend.shtml

When you purchase the Tell-A-Friend script you receive 3 files. tellafriend.cgi, include.cgi, and tellafriend.shtml. tellafriend.shtml is an already finished web page with a form that sends the data to tellafriend.cgi. include.cgi is included and executed into tellafriend.shtml. Using tellafriend.shtml is highly recommended. With it all you need to do is put a link to it on all the pages you want to be linked to. Which ever page sent the visitor to tellafriend.shtml will be linked to in the email.

If you decide to use all three of these files make sure they are all in the same directory (folder) on your site. The web page is very basic so you may want to edit it. If you don't it will work the same. You only need to read through 'Code :: Missing fields redirect' if you are using tellafriend.shtml.

After uploading and chmoding the appropriate files if you get an error message when visiting tellafriend.shtml contact your hosting provider and ask how to get a file to accept Server Sides Includes on your server. The page may appear and the error message could be in the middle of the page.


Code :: Email subject

If you want to specify an unique subject title for emails sent through the sendmail script try this.

<input type="hidden" name="subject" value="'email_subject">

If you want your visitors to choose the subject use this code.

<input type="text" name="subject" value="'email_subject">

Replace 'email_subject' with what you want the subject of every email to be.

The default subject is Hey Friends Name.


Code
:: Redirect

If all of the required fields are filled in the script will redirect users to the URL you specify. Replace 'URL' with the URL you want them sent to. (ie: thanks.html or path/to/thanks.html) If you don't include this code your users will be sent here.

<input type="hidden" name="redirect" value="URL">


Code :: Missing fields redirect

If all or the required fields are NOT filled in the script will redirect users to the URL you specify. Replace 'URL' with the URL you want them sent to. (ie: sorry.html or path/to/sorry.html) If you don't include this code your users will be sent here.

<input type="hidden" name="missing_fields_redirect" value="URL">


Code :: Beginning the form

This code is required for everything to work. If the Sendmail script is not in the same directory (folder) as the page with the form on it then change the action to path/to/tellafriend.cgi.

<form name="tellafriend" method="post" action="tellafriend.cgi">


Code :: Basic layout

This code is required for the email to be delivered. You can change the code around to better fit your site but keep all the names the same as they are below.

Your name: <input type="text" name="sender_name"><br>
Your email: <input type="text" name="sender"><br>
Friends name: <input type="text" name="recipient_name"><br>
Friends email: <input type="text" name="recipient">

If you want to write the email message you self use this code.

<input type="hidden" name="message" value="email_message">

Replace 'email_message' with the message you want the person to receive. Keep in mind the link is already added to the email so don't put that in.

If you want your users to type in a message to there fiends use this code.

<br>Message:<br>
<textarea name="message" cols="35" rows="5"></textarea>


Code :: Link creation method

If you want the email to link to the page where the email was sent the you would use the auto method.

<input type="hidden" name="method" value="auto">

If you want the email to link to a certain page you specify then you should use the manual method.

<input type="hidden" name="method" value="manual">

If using the manual method you also need to specify were you want the email to link to. So you need this code as well.

<input type="hidden" name="url" value="link">

Replace 'link' with the full URL (ie: http://www.cgiwebtools.com) of the page you want it to link to.


Code :: Ending the form

After you have added all the above code finish your form by adding a submit button to send the data to the script.

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

If you want your users to be able reset all or the fields to default and start over add this code.

<input type="reset" name="reset" value="Reset">

And then finish the form with the closing tag.

</form>