Search Engine Ranking SecretsSoftware RevieiwsSearch Engine ListsWeb ServicesAffiliate Program
Search Engine Ranking SecretsSearch Engine SubmissionWeb Site Marketing TipsSearch Engine FAQWeb SurveyKeywords RankingMeta Tags GeneratorLink ExchangeRanking ReportSearch Engine ListsPop Up WindowsFree Font Downloads

FREE Online Affiliate Program
www.WebpageAffiliates.com
Copyright © - updated by www.WebpagePublicity.com
Signup | Affiliate Training Videos | Login

#!/usr/bin/perl ############################################################## # # # Ultimate Affiliate # # ***********SQL EDITION********** # # By Steve Miles # # http://www.groundbreak.com # # # # Copyright 1998-present # # # # Selling or distributing this software or # # modifications of this software without # # permission is expressly forbidden. Permission # # to modify the script for personal use is granted. # # In all cases this header and copyright # # must remain intact. All violators will be # # PROSECUTED to the full extent. # # # ############################################################## use Time::Local; use File::Find; use CGI::Carp qw(fatalsToBrowser); use CGI qw (:standard); $q = new CGI; @stuff = $q->param; foreach $stuff (@stuff) {${$stuff} = $q->param($stuff); ${$stuff} =~ s/\;//ig;} $|++; require "config.cgi"; require "common.cgi"; &Create_DB_Connection; $time = time(); &headers_footers; @daysinmonth = (30,28,31,30,31,30,31,31,30,30,30,31); @monthnames = ("January","February","March","April","May","June","July","August","September","October","November","December"); @hournames = ("12am-1am","1am-2am","2am-3am","3am-4am","4am-5am","5am-6am","6am-7am","7am-8am","8am-9am","9am-10am","10am-11am","11am-12pm","12pm-1pm","1pm-2pm","2pm-3pm","3pm-4pm","4pm-5pm","5pm-6pm","6pm-7pm","7pm-8pm","8pm-9pm","9pm-10pm","10pm-11pm","11pm-12am"); @daynames = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); @fields = (Year,Month,Day,Sponsor,Status,Tier,Username,Password,Email,Name,Address1,Address2,City,State,Zip,Country,Company,Sitename,Siteurl,Terms,Checkname,Phone,Fax,SSNumber); if($action =~ /Get Lost Password/i){&emailpassword;exit;} if($action =~ /Did you lose your password\?/i){&lostpasswordform;exit;} if ($pass) { $pass = crypt($pass, "rocksalt"); } if (!$user) { $user = $q->cookie('statsuser'); } if (!$pass) { $pass = $q->cookie('statspass'); } if (!$user && !$pass) {&loginpage;} if ($bypass) {&to_login;} $SQL = "SELECT * FROM users WHERE Username = '$user'"; &Do_SQL; $row = $sth->fetchrow_hashref; $crypt_password = crypt($row->{'Password'}, "rocksalt"); if ($row->{'Status'} =~ /PENDING/ig || $row->{'Status'} =~ /VALIDATED/ig) {&print_default("This affiliate is still awaiting approval.");exit;} elsif ($pass ne $crypt_password || $user ne $row->{'Username'}) { &to_login; } sub to_login { $cookie1 = $q->cookie(-name=>statsuser, -value=>'', -path=>'/'); $cookie2 = $q->cookie(-name=>statspass, -value=>'', -path=>'/'); print $q->header(-cookie=>[$cookie1,$cookie2]); print< ERROR

 
Login info incorrect...

Usernames and Passwords are case sensitive, you can have your login info sent to your email address if you've forgotten what they are.
 

You will be forwarded to the main stats page in 5 seconds.

Click Here if nothing happens.

EOF exit; } $Tier = $row->{'Tier'}; $cookie1 = $q->cookie(-name=>statsuser, -value=>$user, -path=>'/'); $cookie2 = $q->cookie(-name=>statspass, -value=>$crypt_password, -path=>'/'); foreach $field (@fields) { ${$field} = $row->{"$field"}; } $url_to_clickthru =~ s//$user/g; if ($what_type_of_commission eq "flatfee") { @temporary_tiers = @flatfee_tiers; } else { @temporary_tiers = @percentage_tiers; } foreach $item (@temporary_tiers) { $t++; if ($item > 0) { $final_level = $t;} } (@user_tiers) = split (/\,/, $Tier); foreach $item (@user_tiers) { $i++; if ($item > 0) { $user_final_level = $i;} } $t = 0; $i = 0; if ($user_final_level) { $grand_level = $user_final_level; } else { $grand_level = $final_level; } if($action eq "Update Your Info"){&changeinfoform;exit;} if($action eq "Top 100 Referral Sites"){&create_month_hash;&getreferrers;exit;} if($action eq "Update User Info"){&updateuser;exit;} if($action eq "Yes" || $action eq "Delete Account") { &deleteuser;exit;} if($action eq "Get Link Code" || $action eq "bannercode"){&bannercode;exit;} if($action eq "Year to date" || $action eq "View this year"){&create_month_hash;&year_stats;exit;} if($action eq "In-depth Commissions" || $action eq "View Commissions"){&create_month_hash;&viewtransactions;exit;} if($action eq "pyramid"){&pyramid;exit;} if($action eq "logout"){&logout;exit;} if($action eq "emaildownline") { &emaildownline; exit; } if($action eq "send") {&send; exit; } &create_month_hash; &create_month_stats; &statspage;exit; ###################################################################### # SEND DOWNLINE EMAILS ###################################################################### sub send { #$found = $q->cookie('sentemail'); if ($found) { print $q->header; print< Error
 
You can only send email once an hour...
Click Here
EOF exit; } #$SQL = "SELECT * FROM users WHERE Username = '$user'"; &Do_SQL; #$temp = $sth->fetchrow_hashref; $user_email = $temp->{'Email'}; $emailheader =~ s/\%\%Name\%\%/$row->{'Name'}/ig; $emailheader =~ s/\%\%Email\%\%/$row->{'Email'}/ig; if ($test) { @emails = ($user_email); } else { $SQL="SELECT * FROM users"; &Do_SQL; while ($row = $sth->fetchrow_hashref){ $info{$row->{'Username'}} = [$row->{'Email'},$row->{'OptOut'}]; push @{ $kids{$row->{'Sponsor'}} }, $row->{'Username'}; } $kid = "$user"; if (!$kids{$kid}) { print $q->header; print<There are currently no members in your downline

EOF exit; } else { &crunch1(1); } $o++; sub crunch1 { foreach $kid (@{ $kids{$kid} }) { $newlevel++; if ($limit_levels) { if ($grand_level > $newlevel) { $showitnow++; }} else { $showitnow = 1; } if ($showitnow) { $temp = $newlevel + 1; $payouts{$temp}++; $levels{$temp}++; $total_downline++; if ($to eq "direct" && $temp eq 2) { if (!$info{$kid}[1]) { push (@emails, $info{$kid}[0]); } } else { if (!$info{$kid}[1]) { push (@emails, $info{$kid}[0]); } } &crunch1($newlevel); $showitnow = 0;} $newlevel--; delete($info{$kid}); }} } if ($test) { $temp2 = "Test Email Successful

"; &emaildownline; } else { $cookies = $q->cookie(-name=>sentemail, -value=>1, -expires=>'+1h', -path=>'/'); print $q->header(-cookie=>$cookies); print< Emailing Successful

 
The emailing has been successful...
You will be forwarded to the main stats page in 5 seconds.

Click Here if nothing happens.

EOF } foreach $email (@emails) { if ($email =~ /^[\w\-\.]+\@[\w\-]+\.[\w\-\.]+\w$/) { if ($smtphost) { $smtp = Net::SMTP->new($smtphost); $smtp->mail($user_email); $smtp->to($email); $smtp->data(); $smtp->datasend("From: $user_email\n"); $smtp->datasend("Return-Path: $user_email\n"); $smtp->datasend("To: $email\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("$emailheader\n\n$message\n\n"); $smtp->dataend(); $smtp->quit(); } else { open (MAIL, "|$mailprog -oi -t") || die "Can't open $mailprog!\n"; print MAIL <<"EOF"; From: $user_email Return-Path: $user_email To: $email Subject: $subject $emailheader $message EOF close (MAIL); }}} exit; } ###################################################################### # EMAIL AFFILIATES FORM ###################################################################### sub emaildownline { $SQL = "SELECT * FROM users WHERE Username = '$user'"; &Do_SQL; $row = $sth->fetchrow_hashref; $user_email = $row->{'Email'}; if ($to eq "direct") { $temp = "selected"; } print $q->header; print<$temp2
To:
From:
$user_email
Subject:
Message:
     
EOF } ###################################################################### # Prepare and show tree of affiliates ###################################################################### sub pyramid { ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time()); $month = $mon; $year = $year + 1900; print $q->header; $SQL = "SELECT * FROM users WHERE Username = '$user'"; &Do_SQL; $row = $sth->fetchrow_hashref; print<Downline for $user
Downline for $user as of $monthnames[$month], $year
[return to main page]

EOF if ($affiliate_downline_email && !$row->{'SuspendEmail'}) { print<Click here to email your downline

EOF } $report = "1: $user
\n"; $payouts{1} = 1; $levels{1} = 1; $SQL="SELECT * FROM users"; &Do_SQL; while ($row = $sth->fetchrow_hashref){ $info{$row->{'Username'}} = [$row->{'Email'},$row->{'Name'},$row->{'Month'},$row->{'Day'},$row->{'Year'},$row->{'OptOut'}]; push @{ $kids{$row->{'Sponsor'}} }, $row->{'Username'}; } $kid = "$user"; if (!$kids{$kid}) { print<There are currently no members in your downline

EOF } else { &crunch(1); } $o++; sub crunch { foreach $kid (@{ $kids{$kid} }) { $newlevel++; if ($limit_levels) { if ($grand_level > $newlevel) { $showitnow++; }} else { $showitnow = 1; } if ($showitnow) { $temp = $newlevel + 1; $payouts{$temp}++; $levels{$temp}++; $total_downline++; while ($b < $newlevel) { $report .= "   "; $b++; } $b=0; if ($affiliate_downline_show) { $report .= "$temp: $kid $info{$kid}[0], $info{$kid}[1], $info{$kid}[2]/$info{$kid}[3]/$info{$kid}[4]
\n"; } else { $report .= "$temp: $kid
\n"; } $showitnow = 0;} &crunch($newlevel); $newlevel--; delete($info{$kid}); } } if (!$total_downline) { $total_downline = "0"; } print<

$report       EOF while (!$found_some) { $i++; if ($levels{$i}) { print< EOF } else { $found_some = 1; } } print<
Total in downline:  $total_downline
Level $i:  $levels{$i}
EOF } ###################################################################### # Top Referring Sites for that user ###################################################################### sub getreferrers { print $q->header; &date; &header; print<
Identify your high-traffic links
>> Back to Main Stats Page
 
Top 100 Referring Urls
 
EOF $SQL="SELECT * FROM ua_referers WHERE Id = '$user' ORDER BY Total DESC LIMIT 0,100"; &Do_SQL; while ($row = $sth->fetchrow_hashref){ print "\n"; } $sth->finish; $dbh->disconnect; print<
CLICKS 
Raw Unique     Referring URL

$row->{'Total'}$row->{'Unique_hits'}{'Referer'}\">"; $temp = substr($row->{'Referer'},0,100); print "$temp
$footer EOF $time = time(); $temp = $time - (60 * 60 * 24 * 30); $SQL = "DELETE FROM ua_referers WHERE Date < '$temp'"; &Do_SQL; exit; } ###################################################################### # View User Info ###################################################################### sub changeinfoform { @fields = (Year,Month,Day,Sponsor,Username,Password,Email,Name,Address1,Address2,City,State,Zip,Country,Company,Sitename,Siteurl,Terms,Checkname,Phone,Fax,SSNumber,OptOut,Field1,Field2,Field3,Field4,Field5); $SQL = "SELECT * FROM users WHERE Username LIKE '$user'"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref){ foreach $field (@fields) { ${$field} = $pointer->{"$field"}; } } $sth->finish; $dbh->disconnect; $Sponsor =~ s/\_/ /ig; if ($OptOut) { $optedout = "checked"; } print $q->header; &header; print<
Update your account information

>> Back to Main Stats Page
 
    
 
If you change your username, you will be prompted to log in again.

EOF foreach $field (@fields) { if ($field eq "Terms" || $field eq "Sponsor" || $field eq "Year" || $field eq "Month" || $field eq "Day" || $field =~ /Field/) {} elsif ($field eq "Address1") { print "\n"; } elsif ($field eq "Address2") { print "\n"; } elsif ($field eq "SSNumber") { print "\n"; } elsif ($field eq "Sitename") { print "\n"; } elsif ($field eq "Siteurl") { print "\n"; } else { print "\n"; } } foreach $field (@new_fields) { $o++; $temp = "Field$o"; if ($field) { print "\n"; } } print<

Opt-out of emails
Joined:$Month/$Day/$Year
Sponsor:$Sponsor
Address:
Address Extra:
Tax ID:
Website Name:
Website Url:
$field:
$field:
$footer EOF } ###################################################################### # Update User ###################################################################### sub updateuser { if ($new_Email =~ /^[\w\-\.]+\@[\w\-]+\.[\w\-\.]+\w$/) {} else {&print_default("Not a valid email format!"); exit;} $SQL = "SELECT Username FROM users WHERE Username = '$new_Username'"; &Do_SQL; while ($row = $sth->fetchrow_hashref) { if ($row->{'Username'} ne $old_user) { &print_default("
  • This username is already in use");} } @reserved = split (/,/, $reserved); foreach $item (@reserved) { if ($item eq $new_Username) { &print_default("
  • That username is reserved"); } } if (!$new_Username || $new_Username !~ /^[A-Za-z0-9]+$/) { &print_default("
  • Username must consist of numbers and letters only");} if (!$new_Password || $new_Password !~ /^[A-Za-z0-9]+$/) { &print_default("
  • Passwords do not match");} $count++ while $new_Username =~ /[A-Za-z0-9]/g; if (4 > $count) { &print_default("
  • You need more than 3 and less than 21 characters in your username");} $count = 0; $count++ while $new_Password =~ /[A-Za-z0-9]/g; if (4 > $count) { &print_default("
  • You need more than 3 and less than 21 characters in your password");} foreach $stuff (@stuff) {${$stuff} =~ s/\'/\\\'/g;${$stuff} =~ s/\"/\\\"/g;} $Sponsor =~ s/ /_/ig; if ($new_OptOut ne "on") { $new_OptOut = ""; } else { $new_OptOut = 1; } $SQL="UPDATE users SET Username = '$new_Username', Password = '$new_Password', Email = '$new_Email', Name = '$new_Name', Address1 = '$new_Address1', Address2 = '$new_Address2', City = '$new_City', State = '$new_State', Zip = '$new_Zip', Country = '$new_Country', Company = '$new_Company', Sitename = '$new_Sitename', Siteurl = '$new_Siteurl', Checkname = '$new_Checkname', Phone = '$new_Phone', Fax = '$new_Fax', SSNumber = '$new_SSNumber', OptOut = '$new_OptOut', Field1 = '$new_Field1', Field2 = '$new_Field2', Field3 = '$new_Field3', Field4 = '$new_Field4', Field5 = '$new_Field5' WHERE Username = '$old_user' "; &Do_SQL; $SQL = "UPDATE ua_primary_hits SET Id = '$new_Username' WHERE Id = '$old_user'"; &Do_SQL; $SQL = "UPDATE users SET Sponsor = '$new_Username' WHERE Sponsor = '$old_user'"; &Do_SQL; $SQL = "UPDATE commissions SET Id = '$new_Username' WHERE Id = '$old_user'"; &Do_SQL; $SQL = "UPDATE ua_campaigns SET Id = '$new_Username' WHERE Id = '$old_user'"; &Do_SQL; $SQL = "UPDATE ua_referers SET Id = '$new_Username' WHERE Id = '$old_user'"; &Do_SQL; $SQL = "UPDATE ua_hits SET Id = '$new_Username' WHERE Id = '$old_user'"; &Do_SQL; $sth->finish; $dbh->disconnect; if ($user ne $new_Username) { if ($replicator_on eq 1 && $user =~ /^[A-Za-z0-9]+$/ && $path_to_replicated_pages) { $deletedir = "$path_to_replicated_pages/$user"; *name = *File::Find::name; finddepth \&zap, $deletedir; sub zap { if (!-l && -d _) { rmdir($name); } else { unlink($name); } }} } $Username = $new_Username; @temp = (Field1,Field2,Field3,Field4,Field5); foreach $item (@temp) { push (@signupfields, $item); } foreach $field (@signupfields) { $temp = "new_$field"; ${$field} = ${$temp}; } &replicate; print $q->header; print< SUCCESSFUL SIGNUP!
     
    Your account has been updated...
    You will be forwarded to the main stats page in 5 seconds.

    Click Here if nothing happens.

    EOF exit; } ###################################################################### # Create Stats hashes for this month ###################################################################### sub create_month_stats { $SQL = "SELECT SUM(Month_Total),SUM(Month_Unique) FROM ua_primary_hits WHERE Id = '$user'"; &Do_SQL; $row = $sth->fetchrow_arrayref; $total_month_hits = ${$row}[0]; $unique_month_hits = ${$row}[1]; if (!$total_month_hits) { $total_month_hits = 0; } if (!$unique_month_hits) { $unique_month_hits = 0; } $SQL = "SELECT * FROM ua_primary_hits WHERE Month = '$month' && Year = '$real_year' && Id = '$user'"; &Do_SQL; $row = $sth->fetchrow_hashref; $SQL="SELECT * FROM commissions WHERE Id like '$user'"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref){ $i++; $log_month = $pointer->{'Month'}; $log_year = $pointer->{'Year'}; $log_day = $pointer->{'Day'}; $log_payout = $pointer->{'Commission'}; $log_tier = $pointer->{'Level'}; $log_status = $pointer->{'Status'}; if ($log_year eq $real_year && $log_month eq $month) { if ($log_status ne "PENDING") { $tier = "tier$log_day"; ${$tier}{$i} = $status; $tierA = "tier$log_day\A"; ${$tierA} = ${$tierA} + $log_payout; $total = "total$log_day"; ${$total} = ${$total} + $log_payout; if ($log_status ne "NOTPAID") {$paid_total = $paid_total + $log_payout;} $whole_month_total = $whole_month_total + $log_payout; $sale_number++; }} if ($log_status ne "PENDING") { if ($log_status ne "NOTPAID") {$paid_program_total = $paid_program_total + $log_payout;} $whole_program_total = $whole_program_total + $log_payout; $total_program_commissions++; } } $sth->finish; $i = 0; $mon_max = 0; while ($i < 32) { $temp = "$i\day"; if ($row->{$temp} > $mon_max) { $mon_max = $row->{$temp}; } $i++; } $whole_month_total = (int ($whole_month_total * 100)) / 100; $i = 1; while ($i < 32) { $tier = "tier$i"; $t1 = keys %{$tier}; $big_total = $t1; if ($sales_max < $big_total) {$sales_max = $big_total;} $i++; } if (!$total_program_commissions) { $cpstotal = "n/a"; } else { $cpstotal = int ($unique_month_hits / $total_program_commissions); } if (!$sale_number) { $cps = "n/a"; } else { $cps = int ($row->{'Month_Unique'} / $sale_number); } if (!$cps) { $cps = "0"; } if (!$cpstotal) { $cpstotal = "0"; } if ($paid_program_total > 0 || $paid_program_total < 0) {} else { $paid_program_total = 0; } if ($whole_program_total > 0 || $whole_program_total < 0) {} else { $whole_program_total = 0; } if ($sale_number) {} else { $sale_number = 0; } if ($total_program_commissions) {} else { $total_program_commissions = 0; } if ($whole_month_total > 0 || $whole_month_total < 0) {} else {$whole_month_total=0;} if ($paid_total > 0 || $paid_total < 0) {} else {$paid_total=0;} $days_in_the_month = @days_of_the_month; } ###################################################################### # Delete User ###################################################################### sub deleteuser { if ($action eq "Delete Account") { print $q->header; print<
     
    Are you sure you want to delete your account?

    EOF exit; } $temp = "NO_SPONSOR"; $SQL = "SELECT * FROM users WHERE Username like '$user'"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref) { $temp = $pointer->{'Sponsor'}; } $SQL="DELETE FROM users WHERE Username like '$user'"; &Do_SQL; $SQL="DELETE FROM hits WHERE Id like '$user'"; &Do_SQL; $SQL="DELETE FROM commissions WHERE Id like '$user'"; &Do_SQL; $SQL="DELETE FROM ua_primary_hits WHERE Id like '$user'"; &Do_SQL; $SQL="UPDATE users SET Sponsor = '$temp' WHERE Sponsor = '$user'"; &Do_SQL; $sth->finish; if ($replicator_on eq 1 && $user =~ /^[A-Za-z0-9]+$/ && $path_to_replicated_pages) { $deletedir = "$path_to_replicated_pages/$user"; *name = *File::Find::name; finddepth \&zap, $deletedir; sub zap { if (!-l && -d _) { rmdir($name); } else { unlink($name); } }} print $q->header; print< DELETE SUCCESSFUL
     
    Your Account has been deleted
    You will be forwarded to our main page in 5 seconds.

    Click Here if nothing happens.

    EOF exit; } ###################################################################### # Banner Code Page ###################################################################### sub bannercode { print $q->header; $num_sites = @extra_sites; &header; print<
    Link Code
    EOF if ($grand_level > 1) { print< EOF } if ($clickthru_as_a_dir ne 1 && $replicator_on ne 1) { print< EOF } if ($use_page eq 1 && $replicator_on ne 1) { print< EOF } print<
    EOF if ($type) {} else { print<
    Click Here
    To return to the main affiliate stats page.
    Click Here
    To get banner and text link code to advertise our website.
    Click Here
    To get banner and text link code to advertise our affiliate program and earn commissions on sales generated by new affiliates you sign up.
    Click Here
    To learn how you can track different ad campaigns by including a special variable in your link code.
    Click Here
    To view instructions on how to send clicks through your affiliate url to different pages on our website.
  • $footer EOF exit; } if ($type eq "products" && $num_sites && $show ne "YES" && $use_page) { print< EOF $i = 0; while ($i < 5) { if ($extra_sites[$i]) { print< EOF } $i++; } print<
    Click Here
    To return to the main affiliate stats page.
    Click Here
    For example links to $home
    Click Here
    For example links to http://$extra_sites[$i]
    $footer EOF exit; } if ($type eq "sites") { $temp10 = "$url_to_clickthru&page=http://$extra_sites[$the_site]"; if ($clickthru_as_a_dir) { $temp10 =~ s/\&page\=/\//g; } print<
    CUT & PASTE AFFILIATE CODE:
    Just select and copy the code in the boxes below and paste it into your html pages.
     
    Return to main page

     
    Basic Affiliate Url:

    $temp10
      EOF $num = $the_site + 1; $temp = "site_banners$num"; foreach $banner (@{$temp}) { print<


     
    Graphic Link Example:

    $extra_sites[$the_site]


      EOF } print<


    Text Link Example:

    $extra_sites[$the_site]


      $footer EOF } if ($type eq "products") { print<

    CUT & PASTE AFFILIATE CODE:
    Just select and copy the code in the boxes below and paste it into your html pages.
     
    Return to main page

     
    Main Affiliate Url:

    $url_to_clickthru
      EOF foreach $banner (@url_to_banner) { print<


     
    Graphic Link Example:

    $main_site_name


      EOF } print<


    Text Link Example:

    $main_site_name


      $footer EOF } if ($type eq "program") { print<

    Advertise our affiliate program:
    Earn commissions on the sales generated by affiliates signed up under you!
     
    Return to main page

     
    Send webmasters to our website using the same affiliate URL!

    Main Affiliate Url:

    $url_to_clickthru
      EOF foreach $banner (@url_to_promotional_banner) { print<


     
    Graphic Link Example:

    $main_site_name


      EOF } print<


    Text Link Example:

    $main_site_name


      $footer EOF } if ($type eq "campaign" && $clickthru_as_a_dir ne 1 && $replicator_on ne 1) { print< 
    Return to main page

    Tracking different advertising campaigns:

    To create a campaign, just decide on a one word name for the campaign and append it to your affiliate url by including an extra "campaign" variable. Here's an example for a campaign named "December_Email":

    $url_to_clickthru
    &campaign=December_Email

    You must name the campaign with one word only and NO SPACES.

    To view the monthly results of your campaign, just click on the "Top 100 Referrals" tab at the top of the stats page and your campaign will be tracked there. Good Luck! $footer EOF } if ($type eq "pages" && $replicator_on ne 1) { if ($clickthru_as_a_dir) { $temp11 = "\/"; } else { $temp11 = "\&page="; } print< 
    Return to main page

    Redirecting a click to an alternate web page:

    To send someone to an alternate web page all you need to do is include the FULL URL of the page you want someone to go to at the end of your affiliate URL. Here's an example:

    $url_to_clickthru
    $temp11$home/somepage.html

    EOF if ($page_domain eq ".") { print "You can send clicks to ANY WEB PAGE."; } else { print "You must send people to a page on $page_domain or they will be sent to our main page."; } print< This feature will work with both graphic and text links. $footer EOF } } ###################################################################### # Lost Password Form Page ###################################################################### sub lostpasswordform { print $q->header; print<

    Password Retrieval

     
    Just type in your email address and your
    login name and password will be emailed to you shortly.

    $footer EOF } ###################################################################### # Email lost password ###################################################################### sub emailpassword { $SQL = "SELECT * FROM users WHERE Email LIKE '$email'"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref){ $Username = $pointer->{'Username'}; $Password = $pointer->{'Password'}; } $sth->finish; $dbh->disconnect; if ($Username && $Password && $email) { $message = "Here is your login information: Username: $Username Password: $Password"; if ($smtphost) { $smtp = Net::SMTP->new($smtphost); $smtp->mail($admin_email); $smtp->to($email); $smtp->data(); $smtp->datasend("From: $admin_email\n"); $smtp->datasend("To: $email\n"); $smtp->datasend("Subject: Your $main_site_name Password\n"); $smtp->datasend("\n"); $smtp->datasend("$message\n\n"); $smtp->dataend(); $smtp->quit(); } else { open (MAIL, "|$mailprog -oi -t") || die "Can't open $mailprog!\n"; print MAIL <<"EOF"; To: $email Subject: Your $main_site_name Password From: $admin_email $message EOF close (MAIL); } $foundit = "OK"; } if ($foundit eq "OK") { print $q->header; print< SUCCESSFUL SIGNUP!
     
    Your login info has been sent to $email...

    You will be forwarded to the main stats page in 5 seconds.

    Click Here if nothing happens.

    EOF exit; } else { print $q->header; print< SUCCESSFUL SIGNUP!
     
    $email was not found in our database. Make sure to check the spelling and use the same letter case as you did when you signed up...

    You will be forwarded to the main stats page in 5 seconds.

    Click Here if nothing happens.

    EOF exit; } exit; } ###################################################################### # View Commissions In Depth ###################################################################### sub viewtransactions { print $q->header; if (defined $view_year_com) {$current_year = $view_year_com;} else {$current_year = $real_year;} if (defined $view_month_com) {$current_month = $view_month_com;} else {$current_month = $mon;} if (!$start) { $start = 1; } $mon = $current_month + 1; $SQL="SELECT * FROM commissions WHERE Id like '$user' AND Year like '$current_year' AND Month like '$mon'"; &Do_SQL; while ($row = $sth->fetchrow_hashref){ $a++; $short_month = $row->{'Month'} - 1; $short_month = substr($monthnames[$short_month], 0, 3); if ($row->{'Status'} !~ /PENDING/ig) { if ($a >= $start && !$stop) { if ($a >= ($start + 29)) { $stop = $a; } $record .= "
     $a  $short_month. $row->{'Day'}, $row->{'Year'}  $row->{'Level'}  $row->{'Status'}  $currency$row->{'Commission'}  $row->{'Extras'}
    "; }} } if (!$stop) { $stop = $a; } $sth->finish; $dbh->disconnect; $total_coms = $a; if (!$total_coms) { $total_coms = 0; } &header; print<
    In-Depth Commissions
    >> Back to Main Stats Page
     
    View 

    EOF print< $record EOF if (!$a) { print< EOF } print<
    @monthnames[$current_month] $current_year Commissions - $total_coms total
    EOF if ($a) { print< EOF $stop++; } print<
      DATE LEVEL STATUS AMOUNT EXTRA INFO
    No Commissions this Month!
    $footer EOF } ###################################################################### # Graph of the year ###################################################################### sub year_stats { $SQL = "SELECT * FROM ua_primary_hits WHERE Year = '$real_year' && Id = '$user'"; &Do_SQL; while ($row = $sth->fetchrow_hashref){ $months{$row->{'Month'}} = $months{$row->{'Month'}} + $row->{'Month_Total'}; $unique{$row->{'Month'}} = $unique{$row->{'Month'}} + $row->{'Month_Unique'}; } $SQL="SELECT * FROM commissions WHERE Id like '$user' AND Year like '$real_year'"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref){ $i++; $log_month = $pointer->{'Month'}; $log_payout = $pointer->{'Commission'}; $log_status = $pointer->{'Status'}; if ($log_status !~ /PENDING/ig) { $tier1 = "yearit$log_month"; $tier1T = "yearit$log_month\T"; ${$tier1T} = ${$tier1T} + $log_payout; ${$tier1}{$i} = $status; } } $sth->finish; $dbh->disconnect; $i = 1; $year_max = 0; while ($i < 13) { if ($months{$i} > $year_max) { $year_max = $months{$i}; } $i++; } $i = 1; while ($i < 13) { $tier1 = "yearit$i"; $t1 = keys %{$tier1}; if ($year_commax < $t1) {$year_commax = $t1;} $i++; } print $q->header; &header; print<
    Yearly Overview
     
                   >> RETURN TO MAIN PAGE
     

    Stats for $real_year
    EOF $i = 0; while ($i < 12) { $themonth = @monthnames[$i]; $t = $i + 1; if (!$months{$t}) {$months{$t}=0;} $uniq_num = $unique{$t}; if (!$uniq_num) {$uniq_num=0;} $tier1 = "yearit$t"; $number = keys %{$tier1}; $tier1T = "yearit$t\T"; if (${$tier1T}) {} else {${$tier1T} = 0} ${$tier1T} = (int (${$tier1T} * 100)) / 100; $total_temp = $total_temp + $months{$t}; $total_temp2 = $total_temp2 + $uniq_num; $total_number = $total_number + $number; $total_num = $total_num + ${$tier1T}; if ($i % 2) { $table_color = "$color1"; } else { $table_color = "$color2"; } print< EOF $i++; } print<
     
    CLICKS
    COMMISSIONS
    Month
      
    Raw
    Unique
    Sales
    Earned
            $themonth
     
    $months{$t}
    $uniq_num
    $number
    $currency${$tier1T}
    TOTALS:
     
    $total_temp
    $total_temp2
    $total_number
    $currency$total_num

    EOF if ($graphs_on) { print<
    Traffic analysis for $real_year
    EOF $i++; } print<
    EOF $i = 1; while ($i < 13) { if (!$months{$i}) {$months{$i}=0;} if (!$year_max){ $year_max=100;} if (!$months{$i}) { $temp6 = 0; $temp7 = 0; } else { $temp5 = int($months{$i} / $year_max * 100); $temp6 = int($unique{$i} / $months{$i} * $temp5); $temp7 = $temp5 - $temp6; } if (!$temp6) { $temp6 = 1; } $temp8 = $i - 1; $temp8 = substr($monthnames[$temp8], 0, 3); print<
    EOF if (!$temp7 || $temp7 eq $temp6) { print< EOF } else { print<$temp total hits
    EOF } print<
     $temp8 
    $year_max
    Clicks
    0
     
    Month

    Each bar represents total traffic sent, and also shows the ratio of unique traffic () to duplicate traffic ().

    Commission analysis for $real_year
    EOF $i++; } print<
    EOF $i = 1; while ($i < 13) { $tier = "yearit$i"; $number = keys %{$tier}; if (!$year_commax) {$year_commax=100;} $height = $number / $year_commax * 100; if (!$height) { $height = 1; } $temp8 = $i - 1; $temp8 = substr($monthnames[$temp8], 0, 3); print<
    $number sales
     $temp8 
    $year_commax
    Sales
    0
     
    Month

     sales generated by your referrals

    EOF } print<header(-cookie=>[$cookie1,$cookie2]); &header; print<
    Welcome $Name
     
    Your affiliate url:
    $url_to_clickthru
     
    EOF if ($grand_level > 1 && $show_downline eq 1) { print< You are earning commissions on $grand_level levels.     Click here for your downline.
     
    EOF } print<

    EOF if (!$row->{'Month_Total'}) { $row->{'Month_Total'} = 0; } if (!$row->{'Month_Unique'}) { $row->{'Month_Unique'} = 0; } if ($sale_number) { $sales_conversion = int($row->{'Month_Unique'}/$sale_number); } else { $sales_conversion = 0; } if ($sales_conversion < 1 && $sales_conversion) { $sales_conversion = "< 1"; } if ($total_program_commissions) { $sales_program_conversion = int($unique_month_hits/$total_program_commissions); } else { $sales_program_conversion = 0; } if ($sales_program_conversion < 1 && $sales_program_conversion) { $sales_program_conversion = "< 1"; } print<
    Affiliate Program Summary for $monthnames[$mon] $real_year
        $monthnames[$mon] Accumulated
    Raw Clicks:
    $row->{'Month_Total'} $total_month_hits
    Unique Clicks:
    $row->{'Month_Unique'} $unique_month_hits
    Sales generated:
    $sale_number $total_program_commissions
    Clicks per Sale (CPS):
    $cps $cpstotal
         
    Commissions Earned:
    $currency$whole_month_total
    $currency$whole_program_total
    Paid so far:
    $currency$paid_total $currency$paid_program_total


    Stats for $monthnames[$mon] $real_year
    EOF @the_months = ("Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug","Sept.","Oct.","Nov.","Dec."); $the_month = $the_months[$mon]; $i = 0; while ($i < ($days_in_the_month)) { $the_day = $i+1; $tier = "tier$the_day"; $number = keys %{$tier}; $num = "total$the_day"; ${$num} = (int (${$num} * 100)) / 100; if (${$num} > 0) {} else {${$num} = 0;} $temp1 = $the_day . "day"; $temp2 = $the_day . "u_day"; if (!$row->{$temp1}) { $row->{$temp1} = 0; } if (!$row->{$temp2}) { $row->{$temp2} = 0; } $total_the_day = $total_the_day + $the_day; $total_temp = $total_temp + $row->{$temp1}; $total_temp2 = $total_temp2 + $row->{$temp2}; $total_number = $total_number + $number; $total_num = $total_num + ${$num}; if ($i % 2) { $table_color = "$color1"; } else { $table_color = "$color2"; } print< EOF $i++; } print<
     
    CLICKS
    COMMISSIONS
    Date
      
    Raw
    Unique
    Sales
    Earned
    $the_month $the_day
     
    $row->{$temp1}
    $row->{$temp2}
    $number
    $currency${$num}
    TOTALS:
     
    $total_temp
    $total_temp2
    $total_number
    $currency$total_num

    EOF if ($graphs_on) { print<
    Traffic analysis for $monthnames[$mon] $real_year
    EOF $i++; } print<
    EOF $i = 1; while ($i < ($days_in_the_month+1)) { $temp1 = "$i\day"; if (!$row->{$temp1}) {$row->{$temp1}=0;} if ($mon_max) {} else {$mon_max=100;} $temp2 = $i ."u_day"; $uniq_num = $row->{$temp2}; if (!$row->{$temp1}) { $temp6 = 0; $temp7 = 0; } else { $temp5 = int($row->{$temp1} / $mon_max * 100); $temp6 = int($uniq_num / $row->{$temp1} * $temp5); $temp7 = $temp5 - $temp6; } if (!$temp6) { $temp6 = 1; } print<
    EOF if (!$temp7 || $temp7 eq $temp6) { print< EOF } else { print<$row->{$temp1} total hits
    EOF } print<
    $i
    $mon_max
    Clicks
    0
     
    Day of the Month

    Each bar represents total traffic sent, and also shows the ratio of unique clicks () to duplicates ().

    Commission analysis for $monthnames[$mon] $real_year
    EOF $i++; } print<
    EOF $i = 1; while ($i < ($days_in_the_month+1)) { $tier = "tier$i"; $number1 = keys %{$tier}; $number = $number1; if ($sales_max) {} else {$sales_max=100;} $height = $number / $sales_max * 100; if (!$height) { $height = 1; } print<
    $height sales
    $i
    $sales_max
    Sales
    0
     
    Day of the Month

     sales generated by your referrals

    EOF } print< $footer EOF exit; } ###################################################################### # Print Out the Login Page ###################################################################### sub loginpage { print $q->header; print<Affiliate Stats Login Page
    Log in to see your affiliate stats and change your user info.
    USERNAME:
    PASSWORD:

    Forget your affiliate login info? No problem!
    Just type in your email below and it will be sent to you.

    EMAIL:
    $footer EOF exit; } ####################### REPLICATE THE NEW AFFILIATE'S WEBSITE sub replicate { if ($replicator_on eq 1) { use File::Find; @files = (); @directories = (); find(\&buildem, $path_to_templates); sub buildem { $file = $File::Find::name; if ($file =~ /\./g) { push (@files, $file); } else { push (@directories, $file) } } mkdir ("$path_to_replicated_pages/$Username", 0777); foreach $directory (@directories) { $directory =~ s/$path_to_templates//; mkdir ("$path_to_replicated_pages/$Username$directory", 0777); } foreach $file (@files) { open (FILE, "$file"); flock(FILE, 2); while () { $filestuff .= $_; } flock(FILE, 8); close (FILE); $filestuff =~ s/\%\%([a-zA-Z0-9_]+)\%\%/${$1}/ig; $file =~ s/$path_to_templates//; open (NEWFILE, ">$path_to_replicated_pages/$Username$file"); flock(NEWFILE, 2); print NEWFILE $filestuff; flock(NEWFILE, 8); close (NEWFILE); $filestuff = ""; } } } ###################################################################### # Default Error HTML ###################################################################### sub print_default { print $q->header; print<Affiliate Program
    $_[0]

    EOF if ($action ne "Get Lost Password") { print "Go Back"; } print< EOF exit; } ###################################################################### # Filter pipes ("|") out of user submissions ###################################################################### sub filter{ $temp = $_[0]; $temp =~ s/\|//; return ($temp); } sub logout { $cookie1 = $q->cookie(-name=>statsuser, -value=>"", -path=>'/'); $cookie2 = $q->cookie(-name=>statspass, -value=>"", -path=>'/'); print $q->redirect(-cookie=>[$cookie1,$cookie2], -url=>"stats.cgi"); } ###################################################################### # Date Subroutines ###################################################################### sub create_month_hash { if ($action eq "View" || $action eq "View this year") { $year = $view_year - 1900; $real_year = $year + 1900; $i = 0; foreach $name (@monthnames) { if ($name eq $view_month) { $mon = $i; } $i++; } $time = timelocal(0,0,1,15,$mon,$year); } else {$time = time();} ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time); $month = $mon; while ($month eq $mon) { $mon{$day} = 0; $time = $time - (60 * 60 * 24); ($sec, $min, $hour, $day, $month, $tyear, $dweek, $dyear, $daylight) = localtime($time); } if ($action eq "View" || $action eq "View this year") { $year = $view_year - 1900; $real_year = $year + 1900; $i = 0; foreach $name (@monthnames) { if ($name eq $view_month) { $mon = $i; } $i++; } $time = timelocal(0,0,1,15,$mon,$year); } else {$time = time();} ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time); $month = $mon; while ($month eq $mon) { $mon{$day} = 0; $time = $time + (60 * 60 * 24); ($sec, $min, $hour, $day, $month, $tyear, $dweek, $dyear, $daylight) = localtime($time); } @days_of_the_month = sort { $a <=> $b } (keys %mon); $real_year = $year + 1900; $month = $mon + 1; } sub realdate { $time = time(); ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time); $mon = $mon; $real_year = $year + 1900; } sub date { ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($_[0]); $month = $mon; $year = $year + 1900; } sub headers_footers { open (FILE, "<$path_to_header"); flock(FILE, 2); while () { $header .= "$_"; } flock(FILE, 8); close (FILE); open (FILE, "<$path_to_footer"); flock(FILE, 2); while () { $footer .= "$_"; } flock(FILE, 8); close (FILE); } sub header { print< $header  
    EOF if ($referers_on) { print< EOF } print<
    EOF }

    Contact Us | earch Engine FAQ | Software Reviews | Search Engine Ranking Secrets
    Web Site Survey | Keywords Ranking | Meta Tag Generator | Web Services | Affiliate Program
    Web Site Marketing Tips | Link Exchange | Free Classified Ads | Free Fonts Download
    Pop-Up Ads | Free Downloads | Web Site Ranking Report | Internet Marketing E-books
    Search Engine Lists | Search Engine Optimization Tips | Search Engine Submission Course

    Copyright © Webpage Publicity Agency (All Rights Reserved)