Documentation
REVSHARE PRO


WARNING - THIS IS FARILY ADVANCED CGI CODE

Our support policy confines us to answering SPECIFIC questions about the installation.  We do not teach perl, systems configurations or unix as part of the membership.   If you require this level of support you will have to pay for installation.   Feel free to give it a shot - if you have the time and like to learn you are on the right page.  For more information regarding support policies read the FAQ.  If you prefer to have the system installed for you simply contact PSYBERCORE to have this arranged.

Preleminary Material for review

System Requirements

  • Perl 5
  • Mysql Database Software
  • Msql-Mysql Module
  • DBI Module
  • Crontab recommended for backups
  • Password protection ability recommended
  • Customizable to work with all operating systems
  • Customizable to work with all web servers
  • Server Sides Includes
  • Compatible with IBILL REVSHARE SYSTEM
  • If you are using NT you must have DAF installed
  • Sendmail or Qmail Recommended

WARNING:  This is an advanced cgi system.  You will need a programmer to ensure that you get this installed properly.   It is not recommended that anyone without a programming background attempt to install or administrate this software unless you REALLY like to learn.  Contact PSYBERCORE for further information.

Upgrading?

It is NOT possible to upgrade from previous versions to the V8.0 PROFESSIONAL VERSION

Preliminaries

  • Determine the path to PERL 5 on your web server host.  Note that some web hosting companies run both PERL 4 and PERL 5.  Make ABSOLUTELY sure you are not setting this up under PERL 4.  Ask your administrator if you are not sure.
  • Download the tarfile for this program and save it to your desktop.
  • Unpack the tar archive on your desktop using a program that unpacks UNIX TAR ARCHIVES. I recommend doing this on a telnet account with the tar command to keep the directory structures intact.  If you don't have such a program then download WINZIP FREE from SHAREWARE.COM
  • After you have unpacked the TAR archive you will have a collection of folders and files on your desktop.  Now you have to do some basic editing of each of these files (or at least some of them).  Use a text editor such as wordpad, notepad, BBEdit, simpletext, or teachtext to edit the files.  These are NOT WORD PROCESSOR DOCUMENTS they are just simple TEXT files so don't save them as word processor documents or save them with extentions such as .txt or they will NOT WORK.   Note that there may be a some files inside of folders which are "blank".   This is normal.

Preparing the CGI scripts

Define Path To PERL 5

The first step is to open up each and every file that has a .cgi extention and edit line number one of each script.  Each of the cgi scripts is written in perl 5. For your scripts to run they must know where perl 5 is installed on your web server. The path to perl 5 is defined to a cgi script in the first line of the file. In each of the cgi scripts the first line of code looks something like this:

#!/usr/bin/perl

If the path to perl 5 on your web server is different from /usr/bin/perl you must edit the first line of each cgi script to reflect the correct path. If the path to perl 5 is the same no changes are necessary. If you do not know the path to perl 5 ask the webmaster or system administrator at your server site.  

Previous installations required

This script interfaces with IBILL PROCESSOR so you have to install IBILL PROCESSOR to handle the transactions.  This system handles the affiliates commissions.  Once you have IBILL PROCESSOR installed simply install the REVSHARE FILES and upload the accountcreate.cgi and configure.cgi replacement files included in this tar file over the one distributed with the IBILL PROCESSOR.

Also you have to have ALL of your IBILL MEMBERSHIP SITES using pincodes from the SAME MASTER ACCOUNT.  Since CMI now lets you do all kinds of accounting breakdowns by sub account - using multiple master accounts is useless anyway.

Configure the .cgi files

configure.cgi (the one used by revshare)

This file pretty much runs the whole show.  If you screw this one up don't count on anything working properly.   In other words, make sure you take the time to do this step CORRECTLY.  Ask your administrator for help if you need to.  Below are the variables used in ALL of the other cgi scripts.  All of the other cgi programs use configure.cgi to figure out where certain things are.

$MasterAccountID = "axxxx";

Your IBILL master account number (a8493 or whatever)

$MasterAccountNumber = "axxxx";

Again... Your IBILL master account number (a8493 or whatever)

$agentcode = "pickaname";

Use a UNIQUE name for your site (for example - "myaffiliate", or "salesagent") DO NOT USE SPACES

$mailprogram='/path/to/sendmail';

Full path to SENDMAIL on your webserver

$adminemail = "you\@yourdomain.com";

Your email address (YOU HAVE TO USE THE BACKSLASH HERE!)

$webmasterurl = "http://www.yourdomain.com/path/to/agents/webmasters";

Full URL to the webmasters  directory containing the login form

$clickthroughurl[x] = "http://www.targetdomain.com/";

This is the FULL URL where people will be sent after clicking on your banner. You can have unlimited clickthroughurls with Revshare Pro.   If you are going to promote 3 sites you would have 3 clickthroughurls.  The default configure.cgi file is setup for 3 sites.

$ErrorURL="http://www.yourdomain.com/agents/error.html";

This is the FULL URL to the error.html page (used by the cgi - not by you)

$SuccessURL="http://www.yourdomain.com/agents/thankyou.html";

This is the FULL URL to the thankyou.html page (used by the cgi - not by you)

$cgiurl = "http://www.yourdomain.com/cgi-bin/agents";

Full URL to the agents directory containing the .cgi files

$cgidirectory = "/path/to/cgi-bin/agents";

This is the FULL PATH to the agents directory containing the .cgi files

$datadirectory = "/path/to/agents/data";

This is the FULL PATH to the agents data directory. By default is /path/to/cgi-bin/agents/data

$localurl = "yourdomain.com";

Your domain name

$mysqldatabase= "revsharedatabase";

Your mysql database name.  If you are using a seperate mysql server Set $mysqldatabase to databasenameServername

$mysqlusername= "username";

Your mysql username

$mysqlpassword= "password";

Your mysql password

Upload Your Edited CGI and Database Files

The way I am going to go through this is an installation where 3 sites are being promoted from a common portal.  An example would be if you owned a domain named http://www.money4traffic.com/ and wanted to promote 3 websites from one affiliate system.  No problem - we will do a SINGLE installation of revshare pro and interface it into THREE (3) installations of IBILL PROCESSOR running on different machines.  Sound easy enough?

  • Upload all the cgi files into the /cgi-bin/revshare directory, upload the 3 text files (passwords, memberdatabase, and schedule.db) into /cgi-bin/revshare/data/
  • Upload your admin page into the admin directory, the webmaster login page into the webmasters directory, and the signup page, error.html, thankyou.html into the /revshare/ directory.  If you untarred this by telnet this should all be pretty obvious
  • Dont do anything with the ibp-replacement files (accountcreate.cgi, configure.cgi (for IBILL PROCESSOR) and the .shtml, .hmf files)... yet

Make your banner page cool

  • You will probably want to make the BANNERS PAGE pretty for your affiliates.  To do this, simply edit the html in between the ENDHEADER markers inside of banners.cgi

Password Protect the admin Directory

SEE THE TUTORIAL FOR INSTRUCTIONS FOR PASSWORD PROTECTING DIRECTORIES

Upload Your Banner image(s)

  • Upload your banner(s) into the http://yourdomain/agents/webmaster directory. 

WHEN YOU ARE FINISHED...

http://www.yourdomain.com/revshare/index.html

    SIGNUP PAGE FOR NEW AFFILIATES

http://www.yourdomain.com/revshare/webmasters/index.html

Where users will login to get bannercode, check stats

http://www.yourdomain.com/revshare/admin/index.html

Password protected admin area

File Access Permissions

File access permissions must be set correctly for this program to run. The table below lists the permissions of each file which are to be set by the unix command ( chmod ) used to set the correct access permissions. You must set the access permissions for each of these files.  As usual you will set all .cgi files to 755 (rwx-r-x-r-x)and all other files and directories to 666 (rw-rw-rw).

 CHMOD 755

 CHMOD 777

  • add.cgi
  • agents.cgi
  • banners.cgi
  • bydate.cgi
  • byuser.cgi
  • configure.cgi
  • delete.user.cgi
  • getinfo.cgi
  • login.cgi
  • newday.cgi
  • overview.cgi
  • payout.cgi
  • revoke.cgi
  • revshare.cgi
  • stats.cgi
  • start.cgi
  • data directory and everything inside (schedule.db, passwords, memberdatabase)



Modify your IBILL Processor Installation

You need to already have IBILL PROCESSOR installed on your membership site(s).   Replace the IBILL PROCESSOR FILES accountcreate.cgi and configure.cgi with the ones included with the REVSHARE PRO tarball.  There is only one new variable in the configure.cgi file.  Just point it to the URL of payout.cgi

$payoutcgi = "http://www.yourdomain.com/cgi-bin/revshare/payout.cgi";

Edit your IBILL JOIN BUTTONS

OK - Now here is a point that might seem wierd.  You are going to have to put your JOIN PAGES for your websites on your AFFILIATE DOMAIN.  You can work around this if you know what you are doing using frames or whatever but I am going to only go through the basics of installing this software.  There are hundreds of ways to customize it but that would take forever to discuss. 

You also have to add a server sides includes tag into the form buttons on your IBILL JOIN PAGES.  You may have to rename your page to .shtml instead of .html on some machines - ASK your system administrator the requirements on your server to execute SSI.  The tag should look like this and is inserted inside the html for each join button:

  • <!-- COPY CODE BETWEEN THESE COMMENT LINES FOR EACH CREDIT CARD SUB ACCOUNT -->
  • <form method="POST" action="https://secure.ibill.com/cgi-win/ccard/ccard.exe">
  • <INPUT type="hidden" name="hellopage" value="ibillblack">
  • <input type="hidden" name="reqtype" value="secure">
  • <input type="hidden" name="ref1" value="/path/to/pincodefile">
  • <input type="hidden" name="ref2" value="3">
  • <!--#EXEC CGI="/cgi-bin/revshare/revshare.cgi" -->
  • <input type="hidden" name="account" value="pincodefile">
  • <input type="submit" value="$2.95 for 3 days by credit card"></form>
  • <!-- COPY CODE BETWEEN THESE COMMENT LINES FOR EACH CREDIT CARD SUB ACCOUNT -->

When the button is called up on the index.shtml page it reads the cookie (if any) and adds 2 extra form fields - one is the revshare ID and the other is used by accountcreate.cgi (ref3).  Likewise with the 900.html pages you create for IBILL Processor and check buttons - you just need to make sure that the EXEC CGI command is pasted inside of the button code.  Also for the 900.html pages you need to paste them in the redeem pages (1234567.shtml)

Note that the ref1 variable is the path on your MEMBERSHIP DOMAIN (the membership site).  The join page is on your AFFILIATE DOMAIN but the button will send you to a webgood page which then executes a cgi on your MEMBERSHIP DOMAIN. 

JOIN PAGE =====> HOST ON AFFILIATE DOMAIN ======> WEBGOOD PAGE WILL THEN GO TO  =====> MEMBERSHIP DOMAIN CGI

http://www.affiliatedomain.com/join/index.shtml =====> webgoodpage.hmf ======> accountcreate.cgi

I hope that helps....

Replace web good pages

You have to replace the webgood page(s) with the special versions included with the Revshare Toolkit distribution.  Just edit the form action tags.

Set default commissions in REVSHARE

Before the system will accept any signups you have to setup "DEFAULT REVSHARE SPLITS" inside of the IBILL admin section by logging into your account @ IBILL

Cookies, IP's and Ports

If you haven't guessed by now, this system uses COOKIES to keep track of commissions.  When an surfer clicks on one of your affiliates banners a cookie is set inside their browser and remains there until something like the year 2003.  Anytime that visitor returns to your site and buys something payout.cgi sucks the cookie out of the browser and writes to a database the commission information. 

The thing about cookies (and its a good thing) is that you can only retrieve cookies that you sent.  This means it is totally IMPOSSIBLE for you to read all the cookies in my browser that have been set by 100's of other websites tracking my behaviour.  Cookies can only be read from the exact same IP address and PORT that they were set by.

Notes for NT users

You must turn encryption ON for this installation to work on NT.  Also you will probably (but not required) be using sendmail or a compatible email program or modify add.cgi to work with your system. 

Crontab newday.cgi

The newday.cgi file must be set to execute every day at midnight.  If you dont do this, your stats will become corrupted. 

Setup your MYSQL database

Inside the folder mysql.stuff you will see the perl modules you need to have installed plus a small readme file with the BASIC commands you need to run this software and a file called agents.sql which sets up the database in MYSQL to store all the required data for AGENTS.  To setup the database simply create a folder inside of /path/to/mysql/agents and upload the agents.sql file as ASCII data.  Then from the command line type

../bin/mysqladmin -u root -p create agentsdatabase

This creates the actual database called "agentsdatabase"

../bin/mysql -u root -pMYSQLPASSWORD agentsdatabase < agents.sql

This loads the database tables into mysql

You should then login to MYSQL to "show tables" and make sure everything got setup correctly

../bin/mysql -u root -p agentsdatabase

If you need help with MYSQL you need to go to the source for information:  MYSQL.COM

Operating your Affiliates Program

Note that you have a seperate login area on the stats.cgi (webmaster login) for the CASH reports.  This is because there is no way to tie the CMI database to your local database.  IBILL prevents that.  Thus your affiliates are required to login a seperate time to see the CASH reports.  Your end provides the statistical reports only.

START THE SYSTEM

From telnet cd to the cgi-bin/agents directory and run start.cgi

perl start.cgi

ADMINISTRATION

The administrative interface is basically a navigational and editing interface.  If you take a little time to push buttons you will see how it works.  You can zoom into the statistics from any point starting at the yearly overview and zooming into the individual users statistics.   From the payout menu you can revoke sales or delete affiliates.

EXPORTING PAY TABLES

The payout menu allows you to export the current pay period sales data into a flat file ASCII delimited database which is stored inside the /cgi-bin/agents/logs directory.  The file will be called #.payout.txt where # is the numerical value of the current pay period.  This database structure is set by default to be seperated by the pipe character |

CHANGING PAYOUT SCHEDULES

The file inside of /cgi-bin/data/schedules.db is a table of the pay periods broken up into one pay period per line.  The default pay schedule consists of 24 periods (24 lines).  There are no restrictions to how you can restructure this table.  Make sure you do NOT have any extra blank lines in this file however or it will totally throw off your statistics.

BACKUP PROCEEDURES

It is HIGHLY recommended that you regularly backup your database.  In the event major computer malfunction, power outage, server crash, etc you will be glad you did.  To the MYSQL guru this is easily done by executing the following command by crontab

../bin/mysqldump -u root -pMYSQLPASSWORD agentsdatabase > agentsdatabase.sql

RESTORE DATABASE

To restore your database from a backup you have to DROP your database, recreate the database, then reload the tables with the commands:

DESTROY DATABASE

../bin/mysqladmin -u root -pMYSQLPASSWORD drop agentsdatabase

CREATE DATABASE

../bin/mysqladmin -u root -p create agentsdatabase

CREATE TABLES

../bin/mysql -u root -pMYSQLPASSWORD agentsdatabase < agentsdatabase.sql