Affiliate Master

     STEP THREE:   Configuring the placeorder.cgi program

     This step goes over the configuration and options for the placeorder.cgi program, which does a variety of things, depending on the configuration.  This program has the capability to take in the order information, validate credit card numbers, assign reseller id, compute commissions, and send emails. 

     By far, this program gives you the most options, hence, could take the longest to get setup.  By default, this program is setup to do all the above functions at one time.  If you want to be able to split out the order form and reseller form, you will need to do a little more configuring (see below).

     ABOUT THE SCRIPT NAME
     WHERE TO PLACE PLACEORDER.CGI
     CONFIGURING PLACEORDER.CGI
     CREATING THE ORDER/RESELLER FORM
     USING CREDIT CARD VALIDATION LOGIC
     SEPARATING PLACEORDER.CGI


 

     ABOUT THE SCRIPT NAME

     Each of the scripts within Affiliate Master are NOT limited to the given file name.  In this example, we use placeorder.cgi as the name of the script.  You name rename this file to anything you desire, except it must end with .cgi or .pl (example:  order.cgi, signup.pl).

     If you change the name, just ensure you use the new name anywhere placeorder.cgi is stated below.

     NOTE:  Because of the number of different options with this script, you may end up installation multiple copies of the script under different names.   For instance, if you want the order form and resellers form on separate webpages, you will need to install a copy configured to just take in order information and compute commissions, and a second copy that creates a reseller id record.

[return to top]

 

     WHERE TO PLACE PLACEORDER.CGI

     The best place to setup the placeorder.cgi script is in the root directory of your server, as this gives the shortest website URL address (example: http://www.yourserver.com/placeorder.cgi).

     If you are not able to run cgi scripts from your root directory, you will need to install the program in your cgi-bin directory (sometimes called cgibin or just cgi).  The website URL would then be:   http://www.yourserver.com/cgi-bin/placeorder.cgi

[return to top]

 

     CONFIGURING PLACEORDER.CGI

     NOTE:  This default configuration option explains how to configure the placeorder.cgi to take both the ordering information and assign the reseller id.  Further examples are given below on how to split out the order form and reseller form.

     Pull up the placeorder.cgi file in your favorite text editor.  The first key item to review (and this holds true for all the cgi programs) is the very first line of the program.  This is the path to Perl5, which we looked up in STEP ONE.

     Be sure this path is pointed to Perl5 on your server.  The path should look like:
     #!/usr/bin/perl    (the #! is required)

     Scroll down to line 14 in the program, to the line that is:
     $track_commissions = "YES";

     This setting can be set to YES or NO.  This tells the script whether or not it should act as an order form and calculate commissions for the reseller.   Set this to NO if the script should not calculate commissions.

     Scroll down to line 17 in the program, to the line that is:
     $create_reseller = "YES";

     This setting can be set to YES or NO.  This tells the script whether or no it should create a reseller id record for the new user.  Set this to NO if the script should not create a reseller id.

     Scroll down to line 20 in the program, to the line that is:
     $reselleridfile = "resellerid.txt";

      (only needed if $create_reseller is set to YES)

     This file is used to assign the reseller id.  The reseller id is assigned by taking the first letter of the first name plus the first letter of the last name plus the id number from this file.

     Example:
          First Name: 
David
          Last Name: 
Hasbrouck
          Number From File:   
1000
          Assigned Reseller ID:  DH1000

     Scroll down to line 23 in the program, to the line that is:
     $resellerdb = "resellerdb.txt";

      (only needed if $create_reseller is set to YES)

     This setting is used to define the name of the reseller database file, which stores all the resellers information. 

     You may configure this setting to point to a Virtual Server Path, as discussed in STEP ONE.  This will add a little more security if you are able to place the file below the website root directory.

     Example:
           $resellerdb = "/www/username/sr/resellerdb.txt";

     NOTE:  This file name should be the same in the placeorder.cgi, commissions.cgi and commissions_admin.cgi files.

     Scroll down to line 26 in the program, to the line that is:
     $ordernumfile = "ordernbr.txt";

      (only needed if $track_commissions is set to YES)

     This file is used to assign an order number to the order.

     Scroll down to line 29 and 30 in the program, to the line that is:
# $payout = 10.00;    # example 1
$payout = $FORM{'orderamt'} * .10;   #example 2

      (only needed if $track_commissions is set to YES)

     This setting is used to determine how commissions are calculated for the reseller.  The # at the beginning of the first line means that line has be commented out.  If you use the flat dollar amount line, be sure to remove the # and place # in front of the second line.

     Example 1:  Use this format to assign a flat dollar amount as the commissions for each sale.

Example:
This would write a record to the commissions database for $10.00 everytime someone purchased.
$payout = 10.00;

     Example 2:  Use this format to assign a percentage of sale as the commissions for each sale.

Example:
This would write a record to the commissions database, paying 10% (.10) of the order amount.
$payout = $FORM{'orderamt'} * .10;
 
NOTE:  $FORM{'orderamt'} must be a field on the order form.  When determining the percentage, always use the decimal number format (example:  10% would be .10, 25% would be .25)

     Scroll down to line 33 in the program, to the line that is:
     @required_fields = ("firstname","lastname","email");

     (This field is always required)

     This is used to tell the script which fields in the form are required fields.  The script will not allow successful submission of the form until all required fields have been filled in.

     To add fields, simply place a comma (,) and the field name in quotes (").

     Example:   Add  website
          @required_fields = ("firstname","lastname","email","website")

     Simply list all fields required on the form in this setting.

     Scroll down to line 36 in the program, to the line that is:
     @array_emails = ("emails/touser.txt",
          "emails/tosupport.txt","emails/tosponsor.txt");

     (the above should all be on one line)

     This setting is optional.  It is used to list out which emails will be sent when the form has been successful submitted.

     This example will look in the emails directory for three email files:  touser.txt (sent to the new user/reseller)  tosupport.txt (sent to support)  and  tosponsor.txt (sent to the sponsor of the webpage).

     To add emails to be sent, simply place a comma (,) and the text email file in quotes (").

     Example:   Add   welcome.txt
     @array_emails = ("emails/touser.txt",
          "emails/tosupport.txt","emails/tosponsor.txt",
          "emails/weclome.txt");

     (the above should all be on one line)

     Be sure to upload a file called  welcome.txt to the emails directory.

     Scroll down to line 40 and 41 in the program, to the line that is:
     $default_sponsorname = "My Name";
     $default_sponsoremail = "my\@email.com";

     These two settings are used as the default sponsor name and sponsor email if an invalid reseller id is entered on the form.

     NOTE:   The backslash (\) before the @ sign is required.

     Scroll down to line 44 in the program, to the line that is:
     $sendmail = '/usr/sbin/sendmail -t';

     This setting is the path to your Sendmail program, which we found in STEP ONE.

     NOTE:   Notice that there is a -t after the Sendmail path.  This is needed for Sendmail to properly send the emails.  Be sure the path for Sendmail itself is correct.

     Well, hopefully you got through all those options without too much of a headache.  Most of the options could remain as default settings.  In the end, you should have looked at 10 different key areas to be configured.

[return to top]

 

     CREATING THE ORDER/RESELLER FORM

     When creating the order and/or reseller form, there are only a handful of pre-define fields that are used.  Outside those, you can request any information on the forms and have them outputted to the tosponsor.txt email text file.

     Below is a list of fields that should be used in the online forms:

firstname
This field is used to get the first name of the user
 
lastname
This field is used to get the last name of the user
 
email
This field is used to get the email address of the user
 
sponsorid
This field is used to get the sponsor/reseller id of the webpage.  This field can be define as an input or a hidden field.  When creating the order form, place value="[IDNUMBER]" as the value field to have the reseller id automatically inserted into the form.
 
return_url
This field is used to tell the form what webpage should be displayed after successful submission of the form. 
 
Example:
<input type="hidden" name="return_url"
value="http://www.yourserver.com/

     display.cgi/[IDNUMBER]/thanks.html">
 
orderamt
Only required if the form is an order form.  This is the total amount of the order.  This field is used to calculate commissions based on a percentage.

     You may add as many other fields to the order form as desired.  Be sure to read over STEP SIX on how to display those fields in the email text files.

[return to top]

 

     USING CREDIT CARD VALIDATION LOGIC

     To use this logic, simply pass two fields to the program

cardtype
This is the credit card type.   Valid values are  VISA, Master Card, American Express, and Discover
cardnumber
This is the actual credit card number.
     When these fields are present, a validation will be done to determine if a possible valid credit card number has been entered.  It does not verify whether the credit card is still valid, it just verifies whether it could be a valid credit card number for the given cardtype.

[return to top]

 

     SEPARATING PLACEORDER.CGI

     If you want to have the order form and resellers form separate from each other, follow these steps:

Make Two Copies Of Placeorder.cgi
Copy placeorder.cgi to order.cgi and resellers.cgi
Edit order.cgi
In the order.cgi file, change the $create_reseller setting to "NO" instead of "YES".  This will disable the reseller id logic.
  
Edit resellers.cgi
In the resellers.cgi file, change the $track_commissions setting to "NO" instead of "YES".   This will disable the order and commissions track logic.
Create Separate Forms
Create two different forms, one that takes in order information and point that to order.cgi, and the other to take in the reseller information (firstname, lastname, email being the key fields) and point that to resellers.cgi
 
[return to top]